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

Percentage Accurate: 67.3% → 96.8%
Time: 8.7s
Alternatives: 9
Speedup: 1.1×

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: 67.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: 96.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \frac{\frac{x}{y}}{y} + \frac{\frac{z}{t}}{\frac{t}{z}} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (* x (/ (/ x y) y)) (/ (/ z t) (/ t z))))
double code(double x, double y, double z, double t) {
	return (x * ((x / y) / y)) + ((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 * ((x / y) / y)) + ((z / t) / (t / z))
end function
public static double code(double x, double y, double z, double t) {
	return (x * ((x / y) / y)) + ((z / t) / (t / z));
}
def code(x, y, z, t):
	return (x * ((x / y) / y)) + ((z / t) / (t / z))
function code(x, y, z, t)
	return Float64(Float64(x * Float64(Float64(x / y) / y)) + Float64(Float64(z / t) / Float64(t / z)))
end
function tmp = code(x, y, z, t)
	tmp = (x * ((x / y) / y)) + ((z / t) / (t / z));
end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + N[(N[(z / t), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\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-/l*N/A

      \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
    4. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 87.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z \cdot z}{t \cdot t}\\ \mathbf{if}\;t\_1 \leq 10^{+281}:\\ \;\;\;\;x \cdot \frac{\frac{x}{y}}{y} + t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{z}{t}}{\frac{t}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* z z) (* t t))))
   (if (<= t_1 1e+281) (+ (* x (/ (/ x y) y)) t_1) (/ (/ z t) (/ t z)))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 1e+281) {
		tmp = (x * ((x / y) / y)) + t_1;
	} else {
		tmp = (z / t) / (t / z);
	}
	return tmp;
}
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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * z) / (t * t)
    if (t_1 <= 1d+281) then
        tmp = (x * ((x / y) / y)) + t_1
    else
        tmp = (z / t) / (t / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 1e+281) {
		tmp = (x * ((x / y) / y)) + t_1;
	} else {
		tmp = (z / t) / (t / z);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * z) / (t * t)
	tmp = 0
	if t_1 <= 1e+281:
		tmp = (x * ((x / y) / y)) + t_1
	else:
		tmp = (z / t) / (t / z)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * z) / Float64(t * t))
	tmp = 0.0
	if (t_1 <= 1e+281)
		tmp = Float64(Float64(x * Float64(Float64(x / y) / y)) + t_1);
	else
		tmp = Float64(Float64(z / t) / Float64(t / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * z) / (t * t);
	tmp = 0.0;
	if (t_1 <= 1e+281)
		tmp = (x * ((x / y) / y)) + t_1;
	else
		tmp = (z / t) / (t / z);
	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[LessEqual[t$95$1, 1e+281], N[(N[(x * N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(z / t), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{z}{t}}{\frac{t}{z}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 z z) (*.f64 t t)) < 1e281

    1. Initial program 81.3%

      \[\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-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/r*N/A

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

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

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

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

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

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

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

    if 1e281 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 61.4%

      \[\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-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \left(t \cdot \color{blue}{t}\right)\right)\right) \]
      6. *-lowering-*.f6477.9%

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right) \]
    7. Simplified77.9%

      \[\leadsto \color{blue}{z \cdot \frac{z}{t \cdot t}} \]
    8. Step-by-step derivation
      1. associate-*r/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. clear-numN/A

        \[\leadsto \frac{z}{t} \cdot \frac{1}{\color{blue}{\frac{t}{z}}} \]
      4. un-div-invN/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-/.f6486.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(t, \color{blue}{z}\right)\right) \]
    9. Applied egg-rr86.3%

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

Alternative 3: 82.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq 0.05:\\ \;\;\;\;\frac{\frac{z}{t}}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{\frac{y}{x}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (/ (* x x) (* y y)) 0.05) (/ (/ z t) (/ t z)) (/ (/ x y) (/ y x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * x) / (y * y)) <= 0.05) {
		tmp = (z / t) / (t / z);
	} else {
		tmp = (x / y) / (y / x);
	}
	return tmp;
}
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
    real(8) :: tmp
    if (((x * x) / (y * y)) <= 0.05d0) then
        tmp = (z / t) / (t / z)
    else
        tmp = (x / y) / (y / x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * x) / (y * y)) <= 0.05) {
		tmp = (z / t) / (t / z);
	} else {
		tmp = (x / y) / (y / x);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x * x) / (y * y)) <= 0.05:
		tmp = (z / t) / (t / z)
	else:
		tmp = (x / y) / (y / x)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(Float64(x * x) / Float64(y * y)) <= 0.05)
		tmp = Float64(Float64(z / t) / Float64(t / z));
	else
		tmp = Float64(Float64(x / y) / Float64(y / x));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((x * x) / (y * y)) <= 0.05)
		tmp = (z / t) / (t / z);
	else
		tmp = (x / y) / (y / x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision], 0.05], N[(N[(z / t), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq 0.05:\\
\;\;\;\;\frac{\frac{z}{t}}{\frac{t}{z}}\\

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


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

    1. Initial program 78.9%

      \[\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-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \frac{z}{t \cdot t}} \]
    8. Step-by-step derivation
      1. associate-*r/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. clear-numN/A

        \[\leadsto \frac{z}{t} \cdot \frac{1}{\color{blue}{\frac{t}{z}}} \]
      4. un-div-invN/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-/.f6488.7%

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

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

    if 0.050000000000000003 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 66.5%

      \[\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-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    6. 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. /-lowering-/.f64N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right) \]
    7. Simplified75.7%

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(y, \color{blue}{x}\right)\right) \]
    9. Applied egg-rr82.0%

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

Alternative 4: 82.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq 0.05:\\ \;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{\frac{y}{x}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (/ (* x x) (* y y)) 0.05) (* (/ z t) (/ z t)) (/ (/ x y) (/ y x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * x) / (y * y)) <= 0.05) {
		tmp = (z / t) * (z / t);
	} else {
		tmp = (x / y) / (y / x);
	}
	return tmp;
}
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
    real(8) :: tmp
    if (((x * x) / (y * y)) <= 0.05d0) then
        tmp = (z / t) * (z / t)
    else
        tmp = (x / y) / (y / x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * x) / (y * y)) <= 0.05) {
		tmp = (z / t) * (z / t);
	} else {
		tmp = (x / y) / (y / x);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x * x) / (y * y)) <= 0.05:
		tmp = (z / t) * (z / t)
	else:
		tmp = (x / y) / (y / x)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(Float64(x * x) / Float64(y * y)) <= 0.05)
		tmp = Float64(Float64(z / t) * Float64(z / t));
	else
		tmp = Float64(Float64(x / y) / Float64(y / x));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((x * x) / (y * y)) <= 0.05)
		tmp = (z / t) * (z / t);
	else
		tmp = (x / y) / (y / x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision], 0.05], N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq 0.05:\\
\;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\

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


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

    1. Initial program 78.9%

      \[\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-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \frac{z}{t \cdot t}} \]
    8. Step-by-step derivation
      1. associate-*r/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-/.f6488.5%

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

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

    if 0.050000000000000003 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 66.5%

      \[\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-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    6. 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. /-lowering-/.f64N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right) \]
    7. Simplified75.7%

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(y, \color{blue}{x}\right)\right) \]
    9. Applied egg-rr82.0%

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

Alternative 5: 82.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq 0.05:\\ \;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (/ (* x x) (* y y)) 0.05) (* (/ z t) (/ z t)) (* (/ x y) (/ x y))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * x) / (y * y)) <= 0.05) {
		tmp = (z / t) * (z / t);
	} else {
		tmp = (x / y) * (x / y);
	}
	return tmp;
}
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
    real(8) :: tmp
    if (((x * x) / (y * y)) <= 0.05d0) then
        tmp = (z / t) * (z / t)
    else
        tmp = (x / y) * (x / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * x) / (y * y)) <= 0.05) {
		tmp = (z / t) * (z / t);
	} else {
		tmp = (x / y) * (x / y);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x * x) / (y * y)) <= 0.05:
		tmp = (z / t) * (z / t)
	else:
		tmp = (x / y) * (x / y)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(Float64(x * x) / Float64(y * y)) <= 0.05)
		tmp = Float64(Float64(z / t) * Float64(z / t));
	else
		tmp = Float64(Float64(x / y) * Float64(x / y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((x * x) / (y * y)) <= 0.05)
		tmp = (z / t) * (z / t);
	else
		tmp = (x / y) * (x / y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision], 0.05], N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq 0.05:\\
\;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\

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


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

    1. Initial program 78.9%

      \[\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-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \frac{z}{t \cdot t}} \]
    8. Step-by-step derivation
      1. associate-*r/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-/.f6488.5%

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

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

    if 0.050000000000000003 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 66.5%

      \[\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-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    6. 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. /-lowering-/.f64N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right) \]
    7. Simplified75.7%

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

        \[\leadsto \frac{x \cdot x}{\color{blue}{y \cdot y}} \]
      2. frac-timesN/A

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

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

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

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

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

Alternative 6: 93.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot \frac{z}{t}}{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(x * Float64(Float64(x / y) / y)) + Float64(Float64(z * Float64(z / 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[(x * N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * N[(z / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\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-/l*N/A

      \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
    4. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 73.3% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \cdot t \leq 3.6 \cdot 10^{+83}:\\ \;\;\;\;z \cdot \frac{z}{t \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* t t) 3.6e+83) (* z (/ z (* t t))) (* (/ x y) (/ x y))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t * t) <= 3.6e+83) {
		tmp = z * (z / (t * t));
	} else {
		tmp = (x / y) * (x / y);
	}
	return tmp;
}
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
    real(8) :: tmp
    if ((t * t) <= 3.6d+83) then
        tmp = z * (z / (t * t))
    else
        tmp = (x / y) * (x / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((t * t) <= 3.6e+83) {
		tmp = z * (z / (t * t));
	} else {
		tmp = (x / y) * (x / y);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (t * t) <= 3.6e+83:
		tmp = z * (z / (t * t))
	else:
		tmp = (x / y) * (x / y)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(t * t) <= 3.6e+83)
		tmp = Float64(z * Float64(z / Float64(t * t)));
	else
		tmp = Float64(Float64(x / y) * Float64(x / y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((t * t) <= 3.6e+83)
		tmp = z * (z / (t * t));
	else
		tmp = (x / y) * (x / y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(t * t), $MachinePrecision], 3.6e+83], N[(z * N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 3.6 \cdot 10^{+83}:\\
\;\;\;\;z \cdot \frac{z}{t \cdot t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 t t) < 3.5999999999999997e83

    1. Initial program 75.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-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right) \]
    7. Simplified73.6%

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

    if 3.5999999999999997e83 < (*.f64 t t)

    1. Initial program 67.5%

      \[\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-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    6. 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. /-lowering-/.f64N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right) \]
    7. Simplified68.9%

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

        \[\leadsto \frac{x \cdot x}{\color{blue}{y \cdot y}} \]
      2. frac-timesN/A

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

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

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

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

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

Alternative 8: 67.1% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \cdot y \leq 9.2 \cdot 10^{+137}:\\ \;\;\;\;x \cdot \frac{x}{y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{z}{t \cdot t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* y y) 9.2e+137) (* x (/ x (* y y))) (* z (/ z (* t t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y * y) <= 9.2e+137) {
		tmp = x * (x / (y * y));
	} else {
		tmp = z * (z / (t * t));
	}
	return tmp;
}
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
    real(8) :: tmp
    if ((y * y) <= 9.2d+137) then
        tmp = x * (x / (y * y))
    else
        tmp = z * (z / (t * t))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y * y) <= 9.2e+137) {
		tmp = x * (x / (y * y));
	} else {
		tmp = z * (z / (t * t));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y * y) <= 9.2e+137:
		tmp = x * (x / (y * y))
	else:
		tmp = z * (z / (t * t))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(y * y) <= 9.2e+137)
		tmp = Float64(x * Float64(x / Float64(y * y)));
	else
		tmp = Float64(z * Float64(z / Float64(t * t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y * y) <= 9.2e+137)
		tmp = x * (x / (y * y));
	else
		tmp = z * (z / (t * t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(y * y), $MachinePrecision], 9.2e+137], N[(x * N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \cdot y \leq 9.2 \cdot 10^{+137}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot y}\\

\mathbf{else}:\\
\;\;\;\;z \cdot \frac{z}{t \cdot t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y y) < 9.19999999999999997e137

    1. Initial program 77.0%

      \[\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-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    6. 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. /-lowering-/.f64N/A

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

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

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

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

    if 9.19999999999999997e137 < (*.f64 y y)

    1. Initial program 65.0%

      \[\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-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
      4. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \left(t \cdot \color{blue}{t}\right)\right)\right) \]
      6. *-lowering-*.f6471.3%

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

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

Alternative 9: 52.7% accurate, 2.1× speedup?

\[\begin{array}{l} \\ x \cdot \frac{x}{y \cdot y} \end{array} \]
(FPCore (x y z t) :precision binary64 (* x (/ x (* y y))))
double code(double x, double y, double z, double t) {
	return x * (x / (y * 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 * (x / (y * y))
end function
public static double code(double x, double y, double z, double t) {
	return x * (x / (y * y));
}
def code(x, y, z, t):
	return x * (x / (y * y))
function code(x, y, z, t)
	return Float64(x * Float64(x / Float64(y * y)))
end
function tmp = code(x, y, z, t)
	tmp = x * (x / (y * y));
end
code[x_, y_, z_, t_] := N[(x * N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\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-/l*N/A

      \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot 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(x, \left(\frac{x}{y \cdot y}\right)\right), \left(\frac{\color{blue}{z \cdot z}}{t \cdot t}\right)\right) \]
    4. associate-/r*N/A

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

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

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

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

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

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

    \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y} + \frac{z \cdot z}{t \cdot t}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around inf

    \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
  6. 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. /-lowering-/.f64N/A

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

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

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

    \[\leadsto \color{blue}{x \cdot \frac{x}{y \cdot y}} \]
  8. 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 2024140 
(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))))