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

Percentage Accurate: 66.7% → 99.8%
Time: 9.3s
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: 66.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

    \[\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-*.f6488.3%

      \[\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. Simplified88.3%

    \[\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-/.f6497.6%

      \[\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-rr97.6%

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

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

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

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

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

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

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

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

Alternative 2: 91.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 0:\\
\;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\

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


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

    1. Initial program 64.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-/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-*.f6476.3%

        \[\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. Simplified76.3%

      \[\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-/.f6498.3%

        \[\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-rr98.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
    10. Step-by-step derivation
      1. times-fracN/A

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

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

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

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

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

    if 0.0 < (*.f64 t t)

    1. Initial program 71.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-/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-*.f6492.0%

        \[\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. Simplified92.0%

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

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

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

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

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

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

Alternative 3: 78.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{-243}:\\
\;\;\;\;\frac{\frac{z}{t}}{\frac{t}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 9.99999999999999995e-244

    1. Initial program 70.2%

      \[\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-*.f6487.5%

        \[\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. Simplified87.5%

      \[\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-/.f6497.9%

        \[\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-rr97.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
    10. Step-by-step derivation
      1. times-fracN/A

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

        \[\leadsto \frac{z}{t} \cdot \frac{1}{\color{blue}{\frac{t}{z}}} \]
      3. div-invN/A

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

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

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

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

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

    if 9.99999999999999995e-244 < x

    1. Initial program 69.2%

      \[\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-*.f6489.4%

        \[\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. Simplified89.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 82.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 5 \cdot 10^{-72}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{y}{x}}\\

\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)) < 4.9999999999999996e-72

    1. Initial program 72.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-/.f6484.2%

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

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
      3. clear-numN/A

        \[\leadsto \frac{x}{y} \cdot \frac{1}{\color{blue}{\frac{y}{x}}} \]
      4. un-div-invN/A

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

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

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

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

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

    if 4.9999999999999996e-72 < (/.f64 (*.f64 z z) (*.f64 t t))

    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-*.f6484.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. Simplified84.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.2%

        \[\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.2%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
    10. Step-by-step derivation
      1. times-fracN/A

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

        \[\leadsto \frac{z}{t} \cdot \frac{1}{\color{blue}{\frac{t}{z}}} \]
      3. div-invN/A

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

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

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

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

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

Alternative 5: 82.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 5 \cdot 10^{-72}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{y}{x}}\\

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


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

    1. Initial program 72.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-/.f6484.2%

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

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
      3. clear-numN/A

        \[\leadsto \frac{x}{y} \cdot \frac{1}{\color{blue}{\frac{y}{x}}} \]
      4. un-div-invN/A

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

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

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

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

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

    if 4.9999999999999996e-72 < (/.f64 (*.f64 z z) (*.f64 t t))

    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-*.f6484.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. Simplified84.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.2%

        \[\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.2%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
    10. Step-by-step derivation
      1. times-fracN/A

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

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

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

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

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

Alternative 6: 82.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 5 \cdot 10^{-72}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\

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


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

    1. Initial program 72.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-/.f6484.2%

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

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

        \[\leadsto \frac{x \cdot \frac{x}{y}}{\color{blue}{y}} \]
      2. associate-*l/N/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-/.f6492.4%

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

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

    if 4.9999999999999996e-72 < (/.f64 (*.f64 z z) (*.f64 t t))

    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-*.f6484.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. Simplified84.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.2%

        \[\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.2%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
    10. Step-by-step derivation
      1. times-fracN/A

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

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

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

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

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

Alternative 7: 99.7% accurate, 1.0× speedup?

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

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

    \[\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-*.f6488.3%

      \[\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. Simplified88.3%

    \[\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-/.f6497.6%

      \[\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-rr97.6%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} + \frac{\frac{z}{t}}{\frac{t}{z}} \]
  9. Step-by-step derivation
    1. div-invN/A

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

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

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

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

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

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

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

Alternative 8: 58.9% accurate, 2.1× speedup?

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

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

    \[\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-/.f6457.2%

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

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

      \[\leadsto \frac{x \cdot \frac{x}{y}}{\color{blue}{y}} \]
    2. associate-*l/N/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-/.f6461.5%

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

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

Alternative 9: 57.0% accurate, 2.1× speedup?

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

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

    \[\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-/.f6457.2%

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

    \[\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 2024158 
(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))))