Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1

Percentage Accurate: 65.9% → 99.8%
Time: 8.8s
Alternatives: 6
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
double code(double x, double y, double z, double t) {
	return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((x * x) / (y * y)) + ((z * z) / (t * t))
end function
public static double code(double x, double y, double z, double t) {
	return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
def code(x, y, z, t):
	return ((x * x) / (y * y)) + ((z * z) / (t * t))
function code(x, y, z, t)
	return Float64(Float64(Float64(x * x) / Float64(y * y)) + Float64(Float64(z * z) / Float64(t * t)))
end
function tmp = code(x, y, z, t)
	tmp = ((x * x) / (y * y)) + ((z * z) / (t * t));
end
code[x_, y_, z_, t_] := N[(N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 65.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
double code(double x, double y, double z, double t) {
	return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((x * x) / (y * y)) + ((z * z) / (t * t))
end function
public static double code(double x, double y, double z, double t) {
	return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
def code(x, y, z, t):
	return ((x * x) / (y * y)) + ((z * z) / (t * t))
function code(x, y, z, t)
	return Float64(Float64(Float64(x * x) / Float64(y * y)) + Float64(Float64(z * z) / Float64(t * t)))
end
function tmp = code(x, y, z, t)
	tmp = ((x * x) / (y * y)) + ((z * z) / (t * t));
end
code[x_, y_, z_, t_] := N[(N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\end{array}

Alternative 1: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\frac{x}{y}}{\frac{y}{x}} + \frac{\frac{z}{t}}{\frac{t}{z}} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (/ (/ x y) (/ y x)) (/ (/ z t) (/ t z))))
double code(double x, double y, double z, double t) {
	return ((x / y) / (y / x)) + ((z / t) / (t / z));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((x / y) / (y / x)) + ((z / t) / (t / z))
end function
public static double code(double x, double y, double z, double t) {
	return ((x / y) / (y / x)) + ((z / t) / (t / z));
}
def code(x, y, z, t):
	return ((x / y) / (y / x)) + ((z / t) / (t / z))
function code(x, y, z, t)
	return Float64(Float64(Float64(x / y) / Float64(y / x)) + Float64(Float64(z / t) / Float64(t / z)))
end
function tmp = code(x, y, z, t)
	tmp = ((x / y) / (y / x)) + ((z / t) / (t / z));
end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision] + N[(N[(z / t), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{x}{y}}{\frac{y}{x}} + \frac{\frac{z}{t}}{\frac{t}{z}}
\end{array}
Derivation
  1. Initial program 59.9%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. times-frac78.0%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} + \frac{z \cdot z}{t \cdot t} \]
    2. times-frac99.6%

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\frac{z}{t} \cdot \frac{z}{t}} \]
  3. Simplified99.6%

    \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{z}{t}} \]
  4. Step-by-step derivation
    1. clear-num99.6%

      \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{1}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
    2. un-div-inv99.7%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
  5. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
  6. Step-by-step derivation
    1. clear-num99.7%

      \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \frac{z}{t} \cdot \color{blue}{\frac{1}{\frac{t}{z}}} \]
    2. div-inv99.7%

      \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \color{blue}{\frac{\frac{z}{t}}{\frac{t}{z}}} \]
  7. Applied egg-rr99.7%

    \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \color{blue}{\frac{\frac{z}{t}}{\frac{t}{z}}} \]
  8. Final simplification99.7%

    \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \frac{\frac{z}{t}}{\frac{t}{z}} \]

Alternative 2: 80.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z \cdot z}{t \cdot t}\\ \mathbf{if}\;t_1 \leq 170000000000 \lor \neg \left(t_1 \leq \infty\right):\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* z z) (* t t))))
   (if (or (<= t_1 170000000000.0) (not (<= t_1 INFINITY)))
     (* (/ x y) (/ x y))
     t_1)))
double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if ((t_1 <= 170000000000.0) || !(t_1 <= ((double) INFINITY))) {
		tmp = (x / y) * (x / y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if ((t_1 <= 170000000000.0) || !(t_1 <= Double.POSITIVE_INFINITY)) {
		tmp = (x / y) * (x / y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * z) / (t * t)
	tmp = 0
	if (t_1 <= 170000000000.0) or not (t_1 <= math.inf):
		tmp = (x / y) * (x / y)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * z) / Float64(t * t))
	tmp = 0.0
	if ((t_1 <= 170000000000.0) || !(t_1 <= Inf))
		tmp = Float64(Float64(x / y) * Float64(x / y));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * z) / (t * t);
	tmp = 0.0;
	if ((t_1 <= 170000000000.0) || ~((t_1 <= Inf)))
		tmp = (x / y) * (x / y);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, 170000000000.0], N[Not[LessEqual[t$95$1, Infinity]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{z \cdot z}{t \cdot t}\\
\mathbf{if}\;t_1 \leq 170000000000 \lor \neg \left(t_1 \leq \infty\right):\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 z z) (*.f64 t t)) < 1.7e11 or +inf.0 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 51.3%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. times-frac73.3%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} + \frac{z \cdot z}{t \cdot t} \]
      2. times-frac99.6%

        \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\frac{z}{t} \cdot \frac{z}{t}} \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{z}{t}} \]
    4. Step-by-step derivation
      1. clear-num99.6%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{1}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
      2. un-div-inv99.6%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
    5. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
    6. Step-by-step derivation
      1. clear-num99.6%

        \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \frac{z}{t} \cdot \color{blue}{\frac{1}{\frac{t}{z}}} \]
      2. div-inv99.7%

        \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \color{blue}{\frac{\frac{z}{t}}{\frac{t}{z}}} \]
    7. Applied egg-rr99.7%

      \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \color{blue}{\frac{\frac{z}{t}}{\frac{t}{z}}} \]
    8. Taylor expanded in x around inf 53.2%

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    9. Step-by-step derivation
      1. unpow253.2%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{{y}^{2}} \]
      2. unpow253.2%

        \[\leadsto \frac{x \cdot x}{\color{blue}{y \cdot y}} \]
    10. Simplified53.2%

      \[\leadsto \color{blue}{\frac{x \cdot x}{y \cdot y}} \]
    11. Step-by-step derivation
      1. frac-times77.8%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
    12. Applied egg-rr77.8%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]

    if 1.7e11 < (/.f64 (*.f64 z z) (*.f64 t t)) < +inf.0

    1. Initial program 74.1%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. times-frac85.7%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} + \frac{z \cdot z}{t \cdot t} \]
      2. times-frac99.7%

        \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\frac{z}{t} \cdot \frac{z}{t}} \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{z}{t}} \]
    4. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{1}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
      2. un-div-inv99.7%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
    6. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \frac{z}{t} \cdot \color{blue}{\frac{1}{\frac{t}{z}}} \]
      2. div-inv99.8%

        \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \color{blue}{\frac{\frac{z}{t}}{\frac{t}{z}}} \]
    7. Applied egg-rr99.8%

      \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \color{blue}{\frac{\frac{z}{t}}{\frac{t}{z}}} \]
    8. Step-by-step derivation
      1. associate-/r/99.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y} \cdot x} + \frac{\frac{z}{t}}{\frac{t}{z}} \]
    9. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y} \cdot x} + \frac{\frac{z}{t}}{\frac{t}{z}} \]
    10. Taylor expanded in x around 0 82.8%

      \[\leadsto \color{blue}{\frac{{z}^{2}}{{t}^{2}}} \]
    11. Step-by-step derivation
      1. unpow282.8%

        \[\leadsto \frac{\color{blue}{z \cdot z}}{{t}^{2}} \]
      2. unpow282.8%

        \[\leadsto \frac{z \cdot z}{\color{blue}{t \cdot t}} \]
    12. Simplified82.8%

      \[\leadsto \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 170000000000 \lor \neg \left(\frac{z \cdot z}{t \cdot t} \leq \infty\right):\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot z}{t \cdot t}\\ \end{array} \]

Alternative 3: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{z}{t} \cdot \frac{z}{t} + \frac{x}{y} \cdot \frac{x}{y} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (* (/ z t) (/ z t)) (* (/ x y) (/ x y))))
double code(double x, double y, double z, double t) {
	return ((z / t) * (z / t)) + ((x / y) * (x / y));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((z / t) * (z / t)) + ((x / y) * (x / y))
end function
public static double code(double x, double y, double z, double t) {
	return ((z / t) * (z / t)) + ((x / y) * (x / y));
}
def code(x, y, z, t):
	return ((z / t) * (z / t)) + ((x / y) * (x / y))
function code(x, y, z, t)
	return Float64(Float64(Float64(z / t) * Float64(z / t)) + Float64(Float64(x / y) * Float64(x / y)))
end
function tmp = code(x, y, z, t)
	tmp = ((z / t) * (z / t)) + ((x / y) * (x / y));
end
code[x_, y_, z_, t_] := N[(N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{z}{t} \cdot \frac{z}{t} + \frac{x}{y} \cdot \frac{x}{y}
\end{array}
Derivation
  1. Initial program 59.9%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. times-frac78.0%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} + \frac{z \cdot z}{t \cdot t} \]
    2. times-frac99.6%

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\frac{z}{t} \cdot \frac{z}{t}} \]
  3. Simplified99.6%

    \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{z}{t}} \]
  4. Final simplification99.6%

    \[\leadsto \frac{z}{t} \cdot \frac{z}{t} + \frac{x}{y} \cdot \frac{x}{y} \]

Alternative 4: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\frac{z}{t}}{\frac{t}{z}} + \frac{x}{y} \cdot \frac{x}{y} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (/ (/ z t) (/ t z)) (* (/ x y) (/ x y))))
double code(double x, double y, double z, double t) {
	return ((z / t) / (t / z)) + ((x / y) * (x / y));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((z / t) / (t / z)) + ((x / y) * (x / y))
end function
public static double code(double x, double y, double z, double t) {
	return ((z / t) / (t / z)) + ((x / y) * (x / y));
}
def code(x, y, z, t):
	return ((z / t) / (t / z)) + ((x / y) * (x / y))
function code(x, y, z, t)
	return Float64(Float64(Float64(z / t) / Float64(t / z)) + Float64(Float64(x / y) * Float64(x / y)))
end
function tmp = code(x, y, z, t)
	tmp = ((z / t) / (t / z)) + ((x / y) * (x / y));
end
code[x_, y_, z_, t_] := N[(N[(N[(z / t), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{z}{t}}{\frac{t}{z}} + \frac{x}{y} \cdot \frac{x}{y}
\end{array}
Derivation
  1. Initial program 59.9%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. times-frac78.0%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} + \frac{z \cdot z}{t \cdot t} \]
    2. times-frac99.6%

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\frac{z}{t} \cdot \frac{z}{t}} \]
  3. Simplified99.6%

    \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{z}{t}} \]
  4. Step-by-step derivation
    1. clear-num99.7%

      \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \frac{z}{t} \cdot \color{blue}{\frac{1}{\frac{t}{z}}} \]
    2. div-inv99.7%

      \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \color{blue}{\frac{\frac{z}{t}}{\frac{t}{z}}} \]
  5. Applied egg-rr99.7%

    \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\frac{\frac{z}{t}}{\frac{t}{z}}} \]
  6. Final simplification99.7%

    \[\leadsto \frac{\frac{z}{t}}{\frac{t}{z}} + \frac{x}{y} \cdot \frac{x}{y} \]

Alternative 5: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\frac{x}{y}}{\frac{y}{x}} + \frac{z}{t} \cdot \frac{z}{t} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (/ (/ x y) (/ y x)) (* (/ z t) (/ z t))))
double code(double x, double y, double z, double t) {
	return ((x / y) / (y / x)) + ((z / t) * (z / t));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((x / y) / (y / x)) + ((z / t) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
	return ((x / y) / (y / x)) + ((z / t) * (z / t));
}
def code(x, y, z, t):
	return ((x / y) / (y / x)) + ((z / t) * (z / t))
function code(x, y, z, t)
	return Float64(Float64(Float64(x / y) / Float64(y / x)) + Float64(Float64(z / t) * Float64(z / t)))
end
function tmp = code(x, y, z, t)
	tmp = ((x / y) / (y / x)) + ((z / t) * (z / t));
end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision] + N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{x}{y}}{\frac{y}{x}} + \frac{z}{t} \cdot \frac{z}{t}
\end{array}
Derivation
  1. Initial program 59.9%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. times-frac78.0%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} + \frac{z \cdot z}{t \cdot t} \]
    2. times-frac99.6%

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\frac{z}{t} \cdot \frac{z}{t}} \]
  3. Simplified99.6%

    \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{z}{t}} \]
  4. Step-by-step derivation
    1. clear-num99.6%

      \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{1}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
    2. un-div-inv99.7%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
  5. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
  6. Final simplification99.7%

    \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \frac{z}{t} \cdot \frac{z}{t} \]

Alternative 6: 58.2% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \frac{x}{y} \cdot \frac{x}{y} \end{array} \]
(FPCore (x y z t) :precision binary64 (* (/ x y) (/ x y)))
double code(double x, double y, double z, double t) {
	return (x / y) * (x / y);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x / y) * (x / y)
end function
public static double code(double x, double y, double z, double t) {
	return (x / y) * (x / y);
}
def code(x, y, z, t):
	return (x / y) * (x / y)
function code(x, y, z, t)
	return Float64(Float64(x / y) * Float64(x / y))
end
function tmp = code(x, y, z, t)
	tmp = (x / y) * (x / y);
end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{y} \cdot \frac{x}{y}
\end{array}
Derivation
  1. Initial program 59.9%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. times-frac78.0%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} + \frac{z \cdot z}{t \cdot t} \]
    2. times-frac99.6%

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\frac{z}{t} \cdot \frac{z}{t}} \]
  3. Simplified99.6%

    \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{z}{t}} \]
  4. Step-by-step derivation
    1. clear-num99.6%

      \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{1}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
    2. un-div-inv99.7%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
  5. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} + \frac{z}{t} \cdot \frac{z}{t} \]
  6. Step-by-step derivation
    1. clear-num99.7%

      \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \frac{z}{t} \cdot \color{blue}{\frac{1}{\frac{t}{z}}} \]
    2. div-inv99.7%

      \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \color{blue}{\frac{\frac{z}{t}}{\frac{t}{z}}} \]
  7. Applied egg-rr99.7%

    \[\leadsto \frac{\frac{x}{y}}{\frac{y}{x}} + \color{blue}{\frac{\frac{z}{t}}{\frac{t}{z}}} \]
  8. Taylor expanded in x around inf 44.1%

    \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
  9. Step-by-step derivation
    1. unpow244.1%

      \[\leadsto \frac{\color{blue}{x \cdot x}}{{y}^{2}} \]
    2. unpow244.1%

      \[\leadsto \frac{x \cdot x}{\color{blue}{y \cdot y}} \]
  10. Simplified44.1%

    \[\leadsto \color{blue}{\frac{x \cdot x}{y \cdot y}} \]
  11. Step-by-step derivation
    1. frac-times56.8%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
  12. Applied egg-rr56.8%

    \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
  13. Final simplification56.8%

    \[\leadsto \frac{x}{y} \cdot \frac{x}{y} \]

Developer target: 99.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ {\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2} \end{array} \]
(FPCore (x y z t) :precision binary64 (+ (pow (/ x y) 2.0) (pow (/ z t) 2.0)))
double code(double x, double y, double z, double t) {
	return pow((x / y), 2.0) + pow((z / t), 2.0);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((x / y) ** 2.0d0) + ((z / t) ** 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
	return Math.pow((x / y), 2.0) + Math.pow((z / t), 2.0);
}
def code(x, y, z, t):
	return math.pow((x / y), 2.0) + math.pow((z / t), 2.0)
function code(x, y, z, t)
	return Float64((Float64(x / y) ^ 2.0) + (Float64(z / t) ^ 2.0))
end
function tmp = code(x, y, z, t)
	tmp = ((x / y) ^ 2.0) + ((z / t) ^ 2.0);
end
code[x_, y_, z_, t_] := N[(N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(z / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2}
\end{array}

Reproduce

?
herbie shell --seed 2023185 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1"
  :precision binary64

  :herbie-target
  (+ (pow (/ x y) 2.0) (pow (/ z t) 2.0))

  (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))