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

Percentage Accurate: 66.4% → 99.7%
Time: 10.2s
Alternatives: 10
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 10 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.4% 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.7% accurate, 0.1× speedup?

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

\\
\frac{x}{y} \cdot \frac{x}{y} + {\left(\frac{t}{z}\right)}^{-2}
\end{array}
Derivation
  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-*.f6481.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(z, z\right), \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right) \]
  3. Simplified81.3%

    \[\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. associate-*r/N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\frac{x \cdot \frac{x}{y}}{y}\right), \mathsf{/.f64}\left(\color{blue}{\mathsf{*.f64}\left(z, z\right)}, \mathsf{*.f64}\left(t, t\right)\right)\right) \]
    2. 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, z\right)}, \mathsf{*.f64}\left(t, t\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, z\right)}, \mathsf{*.f64}\left(t, t\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}, z\right), \mathsf{*.f64}\left(t, t\right)\right)\right) \]
    5. /-lowering-/.f6483.9%

      \[\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}{z}\right), \mathsf{*.f64}\left(t, t\right)\right)\right) \]
  6. Applied egg-rr83.9%

    \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} + \frac{z \cdot 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(\frac{1}{\color{blue}{\frac{t \cdot t}{z \cdot z}}}\right)\right) \]
    2. inv-powN/A

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(x, y\right)\right), \left({\left(\frac{t}{z} \cdot \frac{t}{z}\right)}^{-1}\right)\right) \]
    4. unpow-prod-downN/A

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

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

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(x, y\right)\right), \mathsf{pow.f64}\left(\mathsf{/.f64}\left(t, z\right), \left(\color{blue}{-1} + -1\right)\right)\right) \]
    8. metadata-eval99.6%

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

    \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{{\left(\frac{t}{z}\right)}^{-2}} \]
  9. Add Preprocessing

Alternative 2: 81.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 2 \cdot 10^{-140}:\\ \;\;\;\;\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)) 2e-140) (/ (/ 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)) <= 2e-140) {
		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)) <= 2d-140) 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)) <= 2e-140) {
		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)) <= 2e-140:
		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)) <= 2e-140)
		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)) <= 2e-140)
		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], 2e-140], 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 2 \cdot 10^{-140}:\\
\;\;\;\;\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)) < 2e-140

    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-/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-*.f6488.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(z, z\right), \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right) \]
    3. Simplified88.3%

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

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

      \[\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. 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-/.f6489.1%

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

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

    if 2e-140 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 67.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-*.f6476.2%

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

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

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

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

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

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

Alternative 3: 81.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 2 \cdot 10^{-140}:\\ \;\;\;\;\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)) 2e-140) (* (/ 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)) <= 2e-140) {
		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)) <= 2d-140) 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)) <= 2e-140) {
		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)) <= 2e-140:
		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)) <= 2e-140)
		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)) <= 2e-140)
		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], 2e-140], 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 2 \cdot 10^{-140}:\\
\;\;\;\;\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)) < 2e-140

    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-/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-*.f6488.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(z, z\right), \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right) \]
    3. Simplified88.3%

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

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

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

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

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

    if 2e-140 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 67.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-*.f6476.2%

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

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

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

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

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

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

Alternative 4: 99.7% accurate, 1.0× speedup?

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

\\
\frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{z}{t}
\end{array}
Derivation
  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-*.f6481.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(z, z\right), \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right) \]
  3. Simplified81.3%

    \[\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. associate-*r/N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\frac{x \cdot \frac{x}{y}}{y}\right), \mathsf{/.f64}\left(\color{blue}{\mathsf{*.f64}\left(z, z\right)}, \mathsf{*.f64}\left(t, t\right)\right)\right) \]
    2. 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, z\right)}, \mathsf{*.f64}\left(t, t\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, z\right)}, \mathsf{*.f64}\left(t, t\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}, z\right), \mathsf{*.f64}\left(t, t\right)\right)\right) \]
    5. /-lowering-/.f6483.9%

      \[\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}{z}\right), \mathsf{*.f64}\left(t, t\right)\right)\right) \]
  6. Applied egg-rr83.9%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(x, y\right)\right), \left(\frac{z}{t} \cdot \color{blue}{\frac{z}{t}}\right)\right) \]
    2. *-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(\left(\frac{z}{t}\right), \color{blue}{\left(\frac{z}{t}\right)}\right)\right) \]
    3. /-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(\mathsf{/.f64}\left(z, t\right), \left(\frac{\color{blue}{z}}{t}\right)\right)\right) \]
    4. /-lowering-/.f6499.6%

      \[\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, t\right), \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right)\right) \]
  8. Applied egg-rr99.6%

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

Alternative 5: 96.4% 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 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-*.f6481.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(z, z\right), \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right) \]
  3. Simplified81.3%

    \[\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-/.f6496.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, t\right), \mathsf{/.f64}\left(t, \color{blue}{z}\right)\right)\right) \]
  6. Applied egg-rr96.6%

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

Alternative 6: 96.4% accurate, 1.0× speedup?

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

\\
\frac{z}{t} \cdot \frac{z}{t} + x \cdot \frac{\frac{x}{y}}{y}
\end{array}
Derivation
  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-*.f6481.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(z, z\right), \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right) \]
  3. Simplified81.3%

    \[\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. *-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{z}{t}\right)}\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(\mathsf{/.f64}\left(z, t\right), \left(\frac{\color{blue}{z}}{t}\right)\right)\right) \]
    4. /-lowering-/.f6496.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, t\right), \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right)\right) \]
  6. Applied egg-rr96.5%

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

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

Alternative 7: 74.2% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \cdot t \leq 10^{+69}:\\ \;\;\;\;z \cdot \frac{\frac{z}{t}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* t t) 1e+69) (* z (/ (/ z t) t)) (* (/ x y) (/ x y))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t * t) <= 1e+69) {
		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) <= 1d+69) 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) <= 1e+69) {
		tmp = z * ((z / t) / t);
	} else {
		tmp = (x / y) * (x / y);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (t * t) <= 1e+69:
		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) <= 1e+69)
		tmp = Float64(z * Float64(Float64(z / 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) <= 1e+69)
		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], 1e+69], N[(z * N[(N[(z / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 10^{+69}:\\
\;\;\;\;z \cdot \frac{\frac{z}{t}}{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) < 1.0000000000000001e69

    1. Initial program 76.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-*.f6486.4%

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

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

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

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

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

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

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

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

    if 1.0000000000000001e69 < (*.f64 t t)

    1. Initial program 57.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-*.f6475.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. Simplified75.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-*.f6461.8%

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

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

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

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

Alternative 8: 67.2% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 76.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-*.f6486.4%

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

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

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

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

    if 1.1600000000000001e75 < (*.f64 t t)

    1. Initial program 57.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-*.f6475.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. Simplified75.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-*.f6461.8%

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

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

Alternative 9: 62.9% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.2 \cdot 10^{+30}:\\
\;\;\;\;z \cdot \frac{\frac{z}{t}}{t}\\

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


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

    1. Initial program 67.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-*.f6480.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. Simplified80.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-*.f6456.8%

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

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

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

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

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

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

    if 6.1999999999999995e30 < x

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

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

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

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

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

Alternative 10: 52.5% 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 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-*.f6481.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(z, z\right), \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right) \]
  3. Simplified81.3%

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

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

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