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

Percentage Accurate: 65.3% → 97.3%
Time: 9.2s
Alternatives: 9
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 9 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.3% 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: 97.3% accurate, 0.6× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_1 := \frac{x\_m}{y \cdot \frac{y}{x\_m}} + \frac{\frac{z}{\frac{t}{z}}}{t}\\ \mathbf{if}\;x\_m \leq 9.6 \cdot 10^{-186}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x\_m \leq 1.16 \cdot 10^{+210}:\\ \;\;\;\;\frac{x\_m \cdot \frac{x\_m}{y}}{y} + \frac{\frac{z}{t}}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (let* ((t_1 (+ (/ x_m (* y (/ y x_m))) (/ (/ z (/ t z)) t))))
   (if (<= x_m 9.6e-186)
     t_1
     (if (<= x_m 1.16e+210)
       (+ (/ (* x_m (/ x_m y)) y) (/ (/ z t) (/ t z)))
       t_1))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	double t_1 = (x_m / (y * (y / x_m))) + ((z / (t / z)) / t);
	double tmp;
	if (x_m <= 9.6e-186) {
		tmp = t_1;
	} else if (x_m <= 1.16e+210) {
		tmp = ((x_m * (x_m / y)) / y) + ((z / t) / (t / z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (x_m / (y * (y / x_m))) + ((z / (t / z)) / t)
    if (x_m <= 9.6d-186) then
        tmp = t_1
    else if (x_m <= 1.16d+210) then
        tmp = ((x_m * (x_m / y)) / y) + ((z / t) / (t / z))
    else
        tmp = t_1
    end if
    code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	double t_1 = (x_m / (y * (y / x_m))) + ((z / (t / z)) / t);
	double tmp;
	if (x_m <= 9.6e-186) {
		tmp = t_1;
	} else if (x_m <= 1.16e+210) {
		tmp = ((x_m * (x_m / y)) / y) + ((z / t) / (t / z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	t_1 = (x_m / (y * (y / x_m))) + ((z / (t / z)) / t)
	tmp = 0
	if x_m <= 9.6e-186:
		tmp = t_1
	elif x_m <= 1.16e+210:
		tmp = ((x_m * (x_m / y)) / y) + ((z / t) / (t / z))
	else:
		tmp = t_1
	return tmp
x_m = abs(x)
function code(x_m, y, z, t)
	t_1 = Float64(Float64(x_m / Float64(y * Float64(y / x_m))) + Float64(Float64(z / Float64(t / z)) / t))
	tmp = 0.0
	if (x_m <= 9.6e-186)
		tmp = t_1;
	elseif (x_m <= 1.16e+210)
		tmp = Float64(Float64(Float64(x_m * Float64(x_m / y)) / y) + Float64(Float64(z / t) / Float64(t / z)));
	else
		tmp = t_1;
	end
	return tmp
end
x_m = abs(x);
function tmp_2 = code(x_m, y, z, t)
	t_1 = (x_m / (y * (y / x_m))) + ((z / (t / z)) / t);
	tmp = 0.0;
	if (x_m <= 9.6e-186)
		tmp = t_1;
	elseif (x_m <= 1.16e+210)
		tmp = ((x_m * (x_m / y)) / y) + ((z / t) / (t / z));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m / N[(y * N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z / N[(t / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$95$m, 9.6e-186], t$95$1, If[LessEqual[x$95$m, 1.16e+210], N[(N[(N[(x$95$m * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(N[(z / t), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
t_1 := \frac{x\_m}{y \cdot \frac{y}{x\_m}} + \frac{\frac{z}{\frac{t}{z}}}{t}\\
\mathbf{if}\;x\_m \leq 9.6 \cdot 10^{-186}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x\_m \leq 1.16 \cdot 10^{+210}:\\
\;\;\;\;\frac{x\_m \cdot \frac{x\_m}{y}}{y} + \frac{\frac{z}{t}}{\frac{t}{z}}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 9.60000000000000012e-186 or 1.16e210 < x

    1. Initial program 67.2%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \frac{x \cdot x}{y \cdot y} + z \cdot \color{blue}{\frac{z}{t \cdot t}} \]
      2. +-commutativeN/A

        \[\leadsto z \cdot \frac{z}{t \cdot t} + \color{blue}{\frac{x \cdot x}{y \cdot y}} \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(z \cdot \frac{z}{t \cdot t}\right), \color{blue}{\left(\frac{x \cdot x}{y \cdot y}\right)}\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\left(z \cdot \frac{1}{\frac{t \cdot t}{z}}\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      5. un-div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{z}{\frac{t \cdot t}{z}}\right), \left(\frac{\color{blue}{x \cdot x}}{y \cdot y}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{t \cdot t}{z}\right)\right), \left(\frac{\color{blue}{x \cdot x}}{y \cdot y}\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{1}{\frac{z}{t \cdot t}}\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      8. associate-/r*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{1}{\frac{\frac{z}{t}}{t}}\right)\right), \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
      9. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{t}{\frac{z}{t}}\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \left(\frac{z}{t}\right)\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
      12. times-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x}{y} \cdot \color{blue}{\frac{x}{y}}\right)\right) \]
      13. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{1}{\frac{y}{x}} \cdot \frac{\color{blue}{x}}{y}\right)\right) \]
      14. frac-timesN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{1 \cdot x}{\color{blue}{\frac{y}{x} \cdot y}}\right)\right) \]
      15. *-lft-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x}{\color{blue}{\frac{y}{x}} \cdot y}\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \color{blue}{\left(\frac{y}{x} \cdot y\right)}\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\left(\frac{y}{x}\right), \color{blue}{y}\right)\right)\right) \]
      18. /-lowering-/.f6494.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
    4. Applied egg-rr94.9%

      \[\leadsto \color{blue}{\frac{z}{\frac{t}{\frac{z}{t}}} + \frac{x}{\frac{y}{x} \cdot y}} \]
    5. Step-by-step derivation
      1. associate-/r/N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{z}{t} \cdot \frac{z}{t}\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
      2. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{\frac{z}{t} \cdot z}{t}\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(\frac{z}{t} \cdot z\right), t\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(z \cdot \frac{z}{t}\right), t\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(z \cdot \frac{1}{\frac{t}{z}}\right), t\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
      6. un-div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(\frac{z}{\frac{t}{z}}\right), t\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{t}{z}\right)\right), t\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
      8. /-lowering-/.f6496.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, z\right)\right), t\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
    6. Applied egg-rr96.3%

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

    if 9.60000000000000012e-186 < x < 1.16e210

    1. Initial program 70.8%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{x \cdot x}{y \cdot y}\right), \color{blue}{\left(\frac{z \cdot z}{t \cdot t}\right)}\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{\frac{x \cdot x}{y}}{y}\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(\frac{x \cdot x}{y}\right), y\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(x \cdot \frac{x}{y}\right), y\right), \left(\frac{\color{blue}{z} \cdot z}{t \cdot t}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(\frac{x}{y}\right)\right), y\right), \left(\frac{\color{blue}{z} \cdot z}{t \cdot t}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z \cdot z}{t \cdot t}\right)\right) \]
      7. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(z \cdot \color{blue}{\frac{z}{t \cdot t}}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \color{blue}{\left(\frac{z}{t \cdot t}\right)}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \color{blue}{\left(t \cdot t\right)}\right)\right)\right) \]
      10. *-lowering-*.f6494.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right)\right) \]
    3. Simplified94.8%

      \[\leadsto \color{blue}{\frac{x \cdot \frac{x}{y}}{y} + z \cdot \frac{z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z \cdot z}{\color{blue}{t \cdot t}}\right)\right) \]
      2. times-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z}{t} \cdot \color{blue}{\frac{z}{t}}\right)\right) \]
      3. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z}{t} \cdot \frac{1}{\color{blue}{\frac{t}{z}}}\right)\right) \]
      4. un-div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{\frac{z}{t}}{\color{blue}{\frac{t}{z}}}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{/.f64}\left(\left(\frac{z}{t}\right), \color{blue}{\left(\frac{t}{z}\right)}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(z, t\right), \left(\frac{\color{blue}{t}}{z}\right)\right)\right) \]
      7. /-lowering-/.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(t, \color{blue}{z}\right)\right)\right) \]
    6. Applied egg-rr99.7%

      \[\leadsto \frac{x \cdot \frac{x}{y}}{y} + \color{blue}{\frac{\frac{z}{t}}{\frac{t}{z}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 9.6 \cdot 10^{-186}:\\ \;\;\;\;\frac{x}{y \cdot \frac{y}{x}} + \frac{\frac{z}{\frac{t}{z}}}{t}\\ \mathbf{elif}\;x \leq 1.16 \cdot 10^{+210}:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{y} + \frac{\frac{z}{t}}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \frac{y}{x}} + \frac{\frac{z}{\frac{t}{z}}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 96.6% accurate, 0.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \mathsf{fma}\left(\frac{z}{t}, \frac{z}{t}, \frac{x\_m}{y \cdot \frac{y}{x\_m}}\right) \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (fma (/ z t) (/ z t) (/ x_m (* y (/ y x_m)))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	return fma((z / t), (z / t), (x_m / (y * (y / x_m))));
}
x_m = abs(x)
function code(x_m, y, z, t)
	return fma(Float64(z / t), Float64(z / t), Float64(x_m / Float64(y * Float64(y / x_m))))
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision] + N[(x$95$m / N[(y * N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|

\\
\mathsf{fma}\left(\frac{z}{t}, \frac{z}{t}, \frac{x\_m}{y \cdot \frac{y}{x\_m}}\right)
\end{array}
Derivation
  1. Initial program 68.6%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \frac{x \cdot x}{y \cdot y} + z \cdot \color{blue}{\frac{z}{t \cdot t}} \]
    2. +-commutativeN/A

      \[\leadsto z \cdot \frac{z}{t \cdot t} + \color{blue}{\frac{x \cdot x}{y \cdot y}} \]
    3. associate-*r/N/A

      \[\leadsto \frac{z \cdot z}{t \cdot t} + \frac{\color{blue}{x \cdot x}}{y \cdot y} \]
    4. times-fracN/A

      \[\leadsto \frac{z}{t} \cdot \frac{z}{t} + \frac{\color{blue}{x \cdot x}}{y \cdot y} \]
    5. fma-defineN/A

      \[\leadsto \mathsf{fma}\left(\frac{z}{t}, \color{blue}{\frac{z}{t}}, \frac{x \cdot x}{y \cdot y}\right) \]
    6. fma-lowering-fma.f64N/A

      \[\leadsto \mathsf{fma.f64}\left(\left(\frac{z}{t}\right), \color{blue}{\left(\frac{z}{t}\right)}, \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
    7. /-lowering-/.f64N/A

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{/.f64}\left(z, t\right), \left(\frac{\color{blue}{z}}{t}\right), \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(z, \color{blue}{t}\right), \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
    9. times-fracN/A

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(z, t\right), \left(\frac{x}{y} \cdot \frac{x}{y}\right)\right) \]
    10. clear-numN/A

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(z, t\right), \left(\frac{1}{\frac{y}{x}} \cdot \frac{x}{y}\right)\right) \]
    11. frac-timesN/A

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(z, t\right), \left(\frac{1 \cdot x}{\frac{y}{x} \cdot y}\right)\right) \]
    12. *-lft-identityN/A

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(z, t\right), \left(\frac{x}{\frac{y}{x} \cdot y}\right)\right) \]
    13. /-lowering-/.f64N/A

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(x, \left(\frac{y}{x} \cdot y\right)\right)\right) \]
    14. *-lowering-*.f64N/A

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\left(\frac{y}{x}\right), y\right)\right)\right) \]
    15. /-lowering-/.f6497.5%

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
  4. Applied egg-rr97.5%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z}{t}, \frac{z}{t}, \frac{x}{\frac{y}{x} \cdot y}\right)} \]
  5. Final simplification97.5%

    \[\leadsto \mathsf{fma}\left(\frac{z}{t}, \frac{z}{t}, \frac{x}{y \cdot \frac{y}{x}}\right) \]
  6. Add Preprocessing

Alternative 3: 97.9% accurate, 0.7× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \leq 5.8 \cdot 10^{+208}:\\ \;\;\;\;\frac{x\_m \cdot \frac{x\_m}{y}}{y} + \frac{\frac{z}{t}}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{y \cdot \frac{y}{x\_m}} + \frac{z}{\frac{t}{\frac{z}{t}}}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (if (<= x_m 5.8e+208)
   (+ (/ (* x_m (/ x_m y)) y) (/ (/ z t) (/ t z)))
   (+ (/ x_m (* y (/ y x_m))) (/ z (/ t (/ z t))))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	double tmp;
	if (x_m <= 5.8e+208) {
		tmp = ((x_m * (x_m / y)) / y) + ((z / t) / (t / z));
	} else {
		tmp = (x_m / (y * (y / x_m))) + (z / (t / (z / t)));
	}
	return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x_m <= 5.8d+208) then
        tmp = ((x_m * (x_m / y)) / y) + ((z / t) / (t / z))
    else
        tmp = (x_m / (y * (y / x_m))) + (z / (t / (z / t)))
    end if
    code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	double tmp;
	if (x_m <= 5.8e+208) {
		tmp = ((x_m * (x_m / y)) / y) + ((z / t) / (t / z));
	} else {
		tmp = (x_m / (y * (y / x_m))) + (z / (t / (z / t)));
	}
	return tmp;
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	tmp = 0
	if x_m <= 5.8e+208:
		tmp = ((x_m * (x_m / y)) / y) + ((z / t) / (t / z))
	else:
		tmp = (x_m / (y * (y / x_m))) + (z / (t / (z / t)))
	return tmp
x_m = abs(x)
function code(x_m, y, z, t)
	tmp = 0.0
	if (x_m <= 5.8e+208)
		tmp = Float64(Float64(Float64(x_m * Float64(x_m / y)) / y) + Float64(Float64(z / t) / Float64(t / z)));
	else
		tmp = Float64(Float64(x_m / Float64(y * Float64(y / x_m))) + Float64(z / Float64(t / Float64(z / t))));
	end
	return tmp
end
x_m = abs(x);
function tmp_2 = code(x_m, y, z, t)
	tmp = 0.0;
	if (x_m <= 5.8e+208)
		tmp = ((x_m * (x_m / y)) / y) + ((z / t) / (t / z));
	else
		tmp = (x_m / (y * (y / x_m))) + (z / (t / (z / t)));
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := If[LessEqual[x$95$m, 5.8e+208], N[(N[(N[(x$95$m * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(N[(z / t), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(y * N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z / N[(t / N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 5.8 \cdot 10^{+208}:\\
\;\;\;\;\frac{x\_m \cdot \frac{x\_m}{y}}{y} + \frac{\frac{z}{t}}{\frac{t}{z}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y \cdot \frac{y}{x\_m}} + \frac{z}{\frac{t}{\frac{z}{t}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 5.80000000000000017e208

    1. Initial program 67.6%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{x \cdot x}{y \cdot y}\right), \color{blue}{\left(\frac{z \cdot z}{t \cdot t}\right)}\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{\frac{x \cdot x}{y}}{y}\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(\frac{x \cdot x}{y}\right), y\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(x \cdot \frac{x}{y}\right), y\right), \left(\frac{\color{blue}{z} \cdot z}{t \cdot t}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(\frac{x}{y}\right)\right), y\right), \left(\frac{\color{blue}{z} \cdot z}{t \cdot t}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z \cdot z}{t \cdot t}\right)\right) \]
      7. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(z \cdot \color{blue}{\frac{z}{t \cdot t}}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \color{blue}{\left(\frac{z}{t \cdot t}\right)}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \color{blue}{\left(t \cdot t\right)}\right)\right)\right) \]
      10. *-lowering-*.f6485.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right)\right) \]
    3. Simplified85.7%

      \[\leadsto \color{blue}{\frac{x \cdot \frac{x}{y}}{y} + z \cdot \frac{z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z \cdot z}{\color{blue}{t \cdot t}}\right)\right) \]
      2. times-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z}{t} \cdot \color{blue}{\frac{z}{t}}\right)\right) \]
      3. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z}{t} \cdot \frac{1}{\color{blue}{\frac{t}{z}}}\right)\right) \]
      4. un-div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{\frac{z}{t}}{\color{blue}{\frac{t}{z}}}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{/.f64}\left(\left(\frac{z}{t}\right), \color{blue}{\left(\frac{t}{z}\right)}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(z, t\right), \left(\frac{\color{blue}{t}}{z}\right)\right)\right) \]
      7. /-lowering-/.f6496.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(t, \color{blue}{z}\right)\right)\right) \]
    6. Applied egg-rr96.1%

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

    if 5.80000000000000017e208 < x

    1. Initial program 82.4%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \frac{x \cdot x}{y \cdot y} + z \cdot \color{blue}{\frac{z}{t \cdot t}} \]
      2. +-commutativeN/A

        \[\leadsto z \cdot \frac{z}{t \cdot t} + \color{blue}{\frac{x \cdot x}{y \cdot y}} \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(z \cdot \frac{z}{t \cdot t}\right), \color{blue}{\left(\frac{x \cdot x}{y \cdot y}\right)}\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\left(z \cdot \frac{1}{\frac{t \cdot t}{z}}\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      5. un-div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{z}{\frac{t \cdot t}{z}}\right), \left(\frac{\color{blue}{x \cdot x}}{y \cdot y}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{t \cdot t}{z}\right)\right), \left(\frac{\color{blue}{x \cdot x}}{y \cdot y}\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{1}{\frac{z}{t \cdot t}}\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      8. associate-/r*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{1}{\frac{\frac{z}{t}}{t}}\right)\right), \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
      9. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{t}{\frac{z}{t}}\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \left(\frac{z}{t}\right)\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
      12. times-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x}{y} \cdot \color{blue}{\frac{x}{y}}\right)\right) \]
      13. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{1}{\frac{y}{x}} \cdot \frac{\color{blue}{x}}{y}\right)\right) \]
      14. frac-timesN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{1 \cdot x}{\color{blue}{\frac{y}{x} \cdot y}}\right)\right) \]
      15. *-lft-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x}{\color{blue}{\frac{y}{x}} \cdot y}\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \color{blue}{\left(\frac{y}{x} \cdot y\right)}\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\left(\frac{y}{x}\right), \color{blue}{y}\right)\right)\right) \]
      18. /-lowering-/.f6499.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
    4. Applied egg-rr99.3%

      \[\leadsto \color{blue}{\frac{z}{\frac{t}{\frac{z}{t}}} + \frac{x}{\frac{y}{x} \cdot y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.8 \cdot 10^{+208}:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{y} + \frac{\frac{z}{t}}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \frac{y}{x}} + \frac{z}{\frac{t}{\frac{z}{t}}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 80.2% accurate, 0.8× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;\frac{x\_m \cdot x\_m}{y \cdot y} \leq 10^{+291}:\\ \;\;\;\;\frac{\frac{z}{t}}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{y}}{\frac{y}{x\_m}}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (if (<= (/ (* x_m x_m) (* y y)) 1e+291)
   (/ (/ z t) (/ t z))
   (/ (/ x_m y) (/ y x_m))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	double tmp;
	if (((x_m * x_m) / (y * y)) <= 1e+291) {
		tmp = (z / t) / (t / z);
	} else {
		tmp = (x_m / y) / (y / x_m);
	}
	return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (((x_m * x_m) / (y * y)) <= 1d+291) then
        tmp = (z / t) / (t / z)
    else
        tmp = (x_m / y) / (y / x_m)
    end if
    code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	double tmp;
	if (((x_m * x_m) / (y * y)) <= 1e+291) {
		tmp = (z / t) / (t / z);
	} else {
		tmp = (x_m / y) / (y / x_m);
	}
	return tmp;
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	tmp = 0
	if ((x_m * x_m) / (y * y)) <= 1e+291:
		tmp = (z / t) / (t / z)
	else:
		tmp = (x_m / y) / (y / x_m)
	return tmp
x_m = abs(x)
function code(x_m, y, z, t)
	tmp = 0.0
	if (Float64(Float64(x_m * x_m) / Float64(y * y)) <= 1e+291)
		tmp = Float64(Float64(z / t) / Float64(t / z));
	else
		tmp = Float64(Float64(x_m / y) / Float64(y / x_m));
	end
	return tmp
end
x_m = abs(x);
function tmp_2 = code(x_m, y, z, t)
	tmp = 0.0;
	if (((x_m * x_m) / (y * y)) <= 1e+291)
		tmp = (z / t) / (t / z);
	else
		tmp = (x_m / y) / (y / x_m);
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := If[LessEqual[N[(N[(x$95$m * x$95$m), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision], 1e+291], N[(N[(z / t), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / y), $MachinePrecision] / N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
\mathbf{if}\;\frac{x\_m \cdot x\_m}{y \cdot y} \leq 10^{+291}:\\
\;\;\;\;\frac{\frac{z}{t}}{\frac{t}{z}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{\frac{y}{x\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x x) (*.f64 y y)) < 9.9999999999999996e290

    1. Initial program 74.1%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{{z}^{2}}{{t}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{{z}^{2}}{t \cdot \color{blue}{t}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{{z}^{2}}{t}}{\color{blue}{t}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{{z}^{2}}{t}\right), \color{blue}{t}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left({z}^{2}\right), t\right), t\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(z \cdot z\right), t\right), t\right) \]
      6. *-lowering-*.f6467.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(z, z\right), t\right), t\right) \]
    5. Simplified67.7%

      \[\leadsto \color{blue}{\frac{\frac{z \cdot z}{t}}{t}} \]
    6. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \frac{\frac{z}{t} \cdot z}{t} \]
      2. associate-/r/N/A

        \[\leadsto \frac{\frac{z}{\frac{t}{z}}}{t} \]
      3. associate-/l/N/A

        \[\leadsto \frac{z}{\color{blue}{t \cdot \frac{t}{z}}} \]
      4. associate-/r*N/A

        \[\leadsto \frac{\frac{z}{t}}{\color{blue}{\frac{t}{z}}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{z}{t}\right), \color{blue}{\left(\frac{t}{z}\right)}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(z, t\right), \left(\frac{\color{blue}{t}}{z}\right)\right) \]
      7. /-lowering-/.f6482.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(t, \color{blue}{z}\right)\right) \]
    7. Applied egg-rr82.6%

      \[\leadsto \color{blue}{\frac{\frac{z}{t}}{\frac{t}{z}}} \]

    if 9.9999999999999996e290 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 62.1%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{x \cdot x}{{\color{blue}{y}}^{2}} \]
      2. associate-/l*N/A

        \[\leadsto x \cdot \color{blue}{\frac{x}{{y}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{x}{{y}^{2}}\right)}\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{x}{y \cdot \color{blue}{y}}\right)\right) \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{\frac{x}{y}}{\color{blue}{y}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{y}\right)\right) \]
      7. /-lowering-/.f6486.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), y\right)\right) \]
    5. Simplified86.1%

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot \color{blue}{x} \]
      2. associate-*l/N/A

        \[\leadsto \frac{\frac{x}{y} \cdot x}{\color{blue}{y}} \]
      3. associate-/r/N/A

        \[\leadsto \frac{\frac{x}{\frac{y}{x}}}{y} \]
      4. associate-/l/N/A

        \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{y}{x}}} \]
      5. associate-/r*N/A

        \[\leadsto \frac{\frac{x}{y}}{\color{blue}{\frac{y}{x}}} \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(\frac{y}{x}\right)}\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), \left(\frac{\color{blue}{y}}{x}\right)\right) \]
      8. /-lowering-/.f6489.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(y, \color{blue}{x}\right)\right) \]
    7. Applied egg-rr89.2%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 80.2% accurate, 0.8× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;\frac{x\_m \cdot x\_m}{y \cdot y} \leq 10^{+291}:\\ \;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{y}}{\frac{y}{x\_m}}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (if (<= (/ (* x_m x_m) (* y y)) 1e+291)
   (* (/ z t) (/ z t))
   (/ (/ x_m y) (/ y x_m))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	double tmp;
	if (((x_m * x_m) / (y * y)) <= 1e+291) {
		tmp = (z / t) * (z / t);
	} else {
		tmp = (x_m / y) / (y / x_m);
	}
	return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (((x_m * x_m) / (y * y)) <= 1d+291) then
        tmp = (z / t) * (z / t)
    else
        tmp = (x_m / y) / (y / x_m)
    end if
    code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	double tmp;
	if (((x_m * x_m) / (y * y)) <= 1e+291) {
		tmp = (z / t) * (z / t);
	} else {
		tmp = (x_m / y) / (y / x_m);
	}
	return tmp;
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	tmp = 0
	if ((x_m * x_m) / (y * y)) <= 1e+291:
		tmp = (z / t) * (z / t)
	else:
		tmp = (x_m / y) / (y / x_m)
	return tmp
x_m = abs(x)
function code(x_m, y, z, t)
	tmp = 0.0
	if (Float64(Float64(x_m * x_m) / Float64(y * y)) <= 1e+291)
		tmp = Float64(Float64(z / t) * Float64(z / t));
	else
		tmp = Float64(Float64(x_m / y) / Float64(y / x_m));
	end
	return tmp
end
x_m = abs(x);
function tmp_2 = code(x_m, y, z, t)
	tmp = 0.0;
	if (((x_m * x_m) / (y * y)) <= 1e+291)
		tmp = (z / t) * (z / t);
	else
		tmp = (x_m / y) / (y / x_m);
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := If[LessEqual[N[(N[(x$95$m * x$95$m), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision], 1e+291], N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / y), $MachinePrecision] / N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
\mathbf{if}\;\frac{x\_m \cdot x\_m}{y \cdot y} \leq 10^{+291}:\\
\;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{\frac{y}{x\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x x) (*.f64 y y)) < 9.9999999999999996e290

    1. Initial program 74.1%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{{z}^{2}}{{t}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{{z}^{2}}{t \cdot \color{blue}{t}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{{z}^{2}}{t}}{\color{blue}{t}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{{z}^{2}}{t}\right), \color{blue}{t}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left({z}^{2}\right), t\right), t\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(z \cdot z\right), t\right), t\right) \]
      6. *-lowering-*.f6467.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(z, z\right), t\right), t\right) \]
    5. Simplified67.7%

      \[\leadsto \color{blue}{\frac{\frac{z \cdot z}{t}}{t}} \]
    6. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{z \cdot z}{\color{blue}{t \cdot t}} \]
      2. times-fracN/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{z}{t}\right), \color{blue}{\left(\frac{z}{t}\right)}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \left(\frac{\color{blue}{z}}{t}\right)\right) \]
      5. /-lowering-/.f6482.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right) \]
    7. Applied egg-rr82.4%

      \[\leadsto \color{blue}{\frac{z}{t} \cdot \frac{z}{t}} \]

    if 9.9999999999999996e290 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 62.1%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{x \cdot x}{{\color{blue}{y}}^{2}} \]
      2. associate-/l*N/A

        \[\leadsto x \cdot \color{blue}{\frac{x}{{y}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{x}{{y}^{2}}\right)}\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{x}{y \cdot \color{blue}{y}}\right)\right) \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{\frac{x}{y}}{\color{blue}{y}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{y}\right)\right) \]
      7. /-lowering-/.f6486.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), y\right)\right) \]
    5. Simplified86.1%

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot \color{blue}{x} \]
      2. associate-*l/N/A

        \[\leadsto \frac{\frac{x}{y} \cdot x}{\color{blue}{y}} \]
      3. associate-/r/N/A

        \[\leadsto \frac{\frac{x}{\frac{y}{x}}}{y} \]
      4. associate-/l/N/A

        \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{y}{x}}} \]
      5. associate-/r*N/A

        \[\leadsto \frac{\frac{x}{y}}{\color{blue}{\frac{y}{x}}} \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(\frac{y}{x}\right)}\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), \left(\frac{\color{blue}{y}}{x}\right)\right) \]
      8. /-lowering-/.f6489.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(y, \color{blue}{x}\right)\right) \]
    7. Applied egg-rr89.2%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 80.1% accurate, 0.8× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;\frac{x\_m \cdot x\_m}{y \cdot y} \leq 10^{+291}:\\ \;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{y} \cdot \frac{x\_m}{y}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (if (<= (/ (* x_m x_m) (* y y)) 1e+291)
   (* (/ z t) (/ z t))
   (* (/ x_m y) (/ x_m y))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	double tmp;
	if (((x_m * x_m) / (y * y)) <= 1e+291) {
		tmp = (z / t) * (z / t);
	} else {
		tmp = (x_m / y) * (x_m / y);
	}
	return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (((x_m * x_m) / (y * y)) <= 1d+291) then
        tmp = (z / t) * (z / t)
    else
        tmp = (x_m / y) * (x_m / y)
    end if
    code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	double tmp;
	if (((x_m * x_m) / (y * y)) <= 1e+291) {
		tmp = (z / t) * (z / t);
	} else {
		tmp = (x_m / y) * (x_m / y);
	}
	return tmp;
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	tmp = 0
	if ((x_m * x_m) / (y * y)) <= 1e+291:
		tmp = (z / t) * (z / t)
	else:
		tmp = (x_m / y) * (x_m / y)
	return tmp
x_m = abs(x)
function code(x_m, y, z, t)
	tmp = 0.0
	if (Float64(Float64(x_m * x_m) / Float64(y * y)) <= 1e+291)
		tmp = Float64(Float64(z / t) * Float64(z / t));
	else
		tmp = Float64(Float64(x_m / y) * Float64(x_m / y));
	end
	return tmp
end
x_m = abs(x);
function tmp_2 = code(x_m, y, z, t)
	tmp = 0.0;
	if (((x_m * x_m) / (y * y)) <= 1e+291)
		tmp = (z / t) * (z / t);
	else
		tmp = (x_m / y) * (x_m / y);
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := If[LessEqual[N[(N[(x$95$m * x$95$m), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision], 1e+291], N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / y), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
\mathbf{if}\;\frac{x\_m \cdot x\_m}{y \cdot y} \leq 10^{+291}:\\
\;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\

\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y} \cdot \frac{x\_m}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x x) (*.f64 y y)) < 9.9999999999999996e290

    1. Initial program 74.1%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{{z}^{2}}{{t}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{{z}^{2}}{t \cdot \color{blue}{t}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{{z}^{2}}{t}}{\color{blue}{t}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{{z}^{2}}{t}\right), \color{blue}{t}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left({z}^{2}\right), t\right), t\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(z \cdot z\right), t\right), t\right) \]
      6. *-lowering-*.f6467.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(z, z\right), t\right), t\right) \]
    5. Simplified67.7%

      \[\leadsto \color{blue}{\frac{\frac{z \cdot z}{t}}{t}} \]
    6. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{z \cdot z}{\color{blue}{t \cdot t}} \]
      2. times-fracN/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{z}{t}\right), \color{blue}{\left(\frac{z}{t}\right)}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \left(\frac{\color{blue}{z}}{t}\right)\right) \]
      5. /-lowering-/.f6482.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right) \]
    7. Applied egg-rr82.4%

      \[\leadsto \color{blue}{\frac{z}{t} \cdot \frac{z}{t}} \]

    if 9.9999999999999996e290 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 62.1%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{x \cdot x}{{\color{blue}{y}}^{2}} \]
      2. associate-/l*N/A

        \[\leadsto x \cdot \color{blue}{\frac{x}{{y}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{x}{{y}^{2}}\right)}\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{x}{y \cdot \color{blue}{y}}\right)\right) \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{\frac{x}{y}}{\color{blue}{y}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{y}\right)\right) \]
      7. /-lowering-/.f6486.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), y\right)\right) \]
    5. Simplified86.1%

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot \color{blue}{x} \]
      2. associate-*l/N/A

        \[\leadsto \frac{\frac{x}{y} \cdot x}{\color{blue}{y}} \]
      3. associate-/l*N/A

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(\frac{x}{y}\right)}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), \left(\frac{\color{blue}{x}}{y}\right)\right) \]
      6. /-lowering-/.f6489.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(x, \color{blue}{y}\right)\right) \]
    7. Applied egg-rr89.1%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 93.9% accurate, 1.0× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \frac{x\_m}{y \cdot \frac{y}{x\_m}} + \frac{z}{\frac{t}{\frac{z}{t}}} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (+ (/ x_m (* y (/ y x_m))) (/ z (/ t (/ z t)))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	return (x_m / (y * (y / x_m))) + (z / (t / (z / t)));
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x_m / (y * (y / x_m))) + (z / (t / (z / t)))
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	return (x_m / (y * (y / x_m))) + (z / (t / (z / t)));
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	return (x_m / (y * (y / x_m))) + (z / (t / (z / t)))
x_m = abs(x)
function code(x_m, y, z, t)
	return Float64(Float64(x_m / Float64(y * Float64(y / x_m))) + Float64(z / Float64(t / Float64(z / t))))
end
x_m = abs(x);
function tmp = code(x_m, y, z, t)
	tmp = (x_m / (y * (y / x_m))) + (z / (t / (z / t)));
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := N[(N[(x$95$m / N[(y * N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z / N[(t / N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|

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

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \frac{x \cdot x}{y \cdot y} + z \cdot \color{blue}{\frac{z}{t \cdot t}} \]
    2. +-commutativeN/A

      \[\leadsto z \cdot \frac{z}{t \cdot t} + \color{blue}{\frac{x \cdot x}{y \cdot y}} \]
    3. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\left(z \cdot \frac{z}{t \cdot t}\right), \color{blue}{\left(\frac{x \cdot x}{y \cdot y}\right)}\right) \]
    4. clear-numN/A

      \[\leadsto \mathsf{+.f64}\left(\left(z \cdot \frac{1}{\frac{t \cdot t}{z}}\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
    5. un-div-invN/A

      \[\leadsto \mathsf{+.f64}\left(\left(\frac{z}{\frac{t \cdot t}{z}}\right), \left(\frac{\color{blue}{x \cdot x}}{y \cdot y}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{t \cdot t}{z}\right)\right), \left(\frac{\color{blue}{x \cdot x}}{y \cdot y}\right)\right) \]
    7. clear-numN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{1}{\frac{z}{t \cdot t}}\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
    8. associate-/r*N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{1}{\frac{\frac{z}{t}}{t}}\right)\right), \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
    9. clear-numN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{t}{\frac{z}{t}}\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
    10. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \left(\frac{z}{t}\right)\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
    11. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
    12. times-fracN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x}{y} \cdot \color{blue}{\frac{x}{y}}\right)\right) \]
    13. clear-numN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{1}{\frac{y}{x}} \cdot \frac{\color{blue}{x}}{y}\right)\right) \]
    14. frac-timesN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{1 \cdot x}{\color{blue}{\frac{y}{x} \cdot y}}\right)\right) \]
    15. *-lft-identityN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x}{\color{blue}{\frac{y}{x}} \cdot y}\right)\right) \]
    16. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \color{blue}{\left(\frac{y}{x} \cdot y\right)}\right)\right) \]
    17. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\left(\frac{y}{x}\right), \color{blue}{y}\right)\right)\right) \]
    18. /-lowering-/.f6494.6%

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
  4. Applied egg-rr94.6%

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

    \[\leadsto \frac{x}{y \cdot \frac{y}{x}} + \frac{z}{\frac{t}{\frac{z}{t}}} \]
  6. Add Preprocessing

Alternative 8: 57.6% accurate, 2.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \frac{x\_m}{y} \cdot \frac{x\_m}{y} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t) :precision binary64 (* (/ x_m y) (/ x_m y)))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	return (x_m / y) * (x_m / y);
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x_m / y) * (x_m / y)
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	return (x_m / y) * (x_m / y);
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	return (x_m / y) * (x_m / y)
x_m = abs(x)
function code(x_m, y, z, t)
	return Float64(Float64(x_m / y) * Float64(x_m / y))
end
x_m = abs(x);
function tmp = code(x_m, y, z, t)
	tmp = (x_m / y) * (x_m / y);
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := N[(N[(x$95$m / y), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|

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

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf

    \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \frac{x \cdot x}{{\color{blue}{y}}^{2}} \]
    2. associate-/l*N/A

      \[\leadsto x \cdot \color{blue}{\frac{x}{{y}^{2}}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{x}{{y}^{2}}\right)}\right) \]
    4. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{x}{y \cdot \color{blue}{y}}\right)\right) \]
    5. associate-/r*N/A

      \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{\frac{x}{y}}{\color{blue}{y}}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{y}\right)\right) \]
    7. /-lowering-/.f6458.0%

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), y\right)\right) \]
  5. Simplified58.0%

    \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y}} \]
  6. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \frac{\frac{x}{y}}{y} \cdot \color{blue}{x} \]
    2. associate-*l/N/A

      \[\leadsto \frac{\frac{x}{y} \cdot x}{\color{blue}{y}} \]
    3. associate-/l*N/A

      \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(\frac{x}{y}\right)}\right) \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), \left(\frac{\color{blue}{x}}{y}\right)\right) \]
    6. /-lowering-/.f6459.4%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(x, \color{blue}{y}\right)\right) \]
  7. Applied egg-rr59.4%

    \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
  8. Add Preprocessing

Alternative 9: 55.5% accurate, 2.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x\_m \cdot \frac{\frac{x\_m}{y}}{y} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t) :precision binary64 (* x_m (/ (/ x_m y) y)))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	return x_m * ((x_m / y) / y);
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x_m * ((x_m / y) / y)
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	return x_m * ((x_m / y) / y);
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	return x_m * ((x_m / y) / y)
x_m = abs(x)
function code(x_m, y, z, t)
	return Float64(x_m * Float64(Float64(x_m / y) / y))
end
x_m = abs(x);
function tmp = code(x_m, y, z, t)
	tmp = x_m * ((x_m / y) / y);
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := N[(x$95$m * N[(N[(x$95$m / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|

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

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf

    \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \frac{x \cdot x}{{\color{blue}{y}}^{2}} \]
    2. associate-/l*N/A

      \[\leadsto x \cdot \color{blue}{\frac{x}{{y}^{2}}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{x}{{y}^{2}}\right)}\right) \]
    4. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{x}{y \cdot \color{blue}{y}}\right)\right) \]
    5. associate-/r*N/A

      \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{\frac{x}{y}}{\color{blue}{y}}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{y}\right)\right) \]
    7. /-lowering-/.f6458.0%

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), y\right)\right) \]
  5. Simplified58.0%

    \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y}} \]
  6. Add Preprocessing

Developer Target 1: 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 2024152 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1"
  :precision binary64

  :alt
  (! :herbie-platform default (+ (pow (/ x y) 2) (pow (/ z t) 2)))

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