Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A

Percentage Accurate: 68.6% → 99.9%
Time: 10.2s
Alternatives: 9
Speedup: 1.2×

Specification

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

\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\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: 68.6% accurate, 1.0× speedup?

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

\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}

Alternative 1: 99.9% accurate, 1.2× speedup?

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

\\
\frac{y + \frac{x - z}{\frac{y}{z + x}}}{2}
\end{array}
Derivation
  1. Initial program 70.7%

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
  2. Step-by-step derivation
    1. associate-/r*N/A

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
    6. div-subN/A

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

      \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
    9. *-inversesN/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
    15. *-lowering-*.f6482.9%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
  3. Simplified82.9%

    \[\leadsto \color{blue}{\frac{y - \frac{z \cdot z - x \cdot x}{y}}{2}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. clear-numN/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \left(\frac{y}{z \cdot z - x \cdot x}\right)\right)\right), 2\right) \]
    3. difference-of-squaresN/A

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{y}{z + x}\right), \left(z - x\right)\right)\right)\right), 2\right) \]
    6. /-lowering-/.f64N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, \mathsf{+.f64}\left(z, x\right)\right), \left(z - x\right)\right)\right)\right), 2\right) \]
    8. --lowering--.f6499.8%

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(z, x\right), \mathsf{/.f64}\left(y, \left(z + x\right)\right)\right)\right), 2\right) \]
    5. +-lowering-+.f6499.8%

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

    \[\leadsto \frac{y - \color{blue}{\frac{z - x}{\frac{y}{z + x}}}}{2} \]
  9. Final simplification99.8%

    \[\leadsto \frac{y + \frac{x - z}{\frac{y}{z + x}}}{2} \]
  10. Add Preprocessing

Alternative 2: 73.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y + \frac{x \cdot x}{y}}{2}\\ \mathbf{if}\;z \cdot z \leq 10^{+53}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+173}:\\ \;\;\;\;\frac{z \cdot z}{y} \cdot -0.5\\ \mathbf{elif}\;z \cdot z \leq 10^{+268}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{y} \cdot \left(z \cdot -0.5\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (+ y (/ (* x x) y)) 2.0)))
   (if (<= (* z z) 1e+53)
     t_0
     (if (<= (* z z) 2e+173)
       (* (/ (* z z) y) -0.5)
       (if (<= (* z z) 1e+268) t_0 (* (/ z y) (* z -0.5)))))))
double code(double x, double y, double z) {
	double t_0 = (y + ((x * x) / y)) / 2.0;
	double tmp;
	if ((z * z) <= 1e+53) {
		tmp = t_0;
	} else if ((z * z) <= 2e+173) {
		tmp = ((z * z) / y) * -0.5;
	} else if ((z * z) <= 1e+268) {
		tmp = t_0;
	} else {
		tmp = (z / y) * (z * -0.5);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (y + ((x * x) / y)) / 2.0d0
    if ((z * z) <= 1d+53) then
        tmp = t_0
    else if ((z * z) <= 2d+173) then
        tmp = ((z * z) / y) * (-0.5d0)
    else if ((z * z) <= 1d+268) then
        tmp = t_0
    else
        tmp = (z / y) * (z * (-0.5d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (y + ((x * x) / y)) / 2.0;
	double tmp;
	if ((z * z) <= 1e+53) {
		tmp = t_0;
	} else if ((z * z) <= 2e+173) {
		tmp = ((z * z) / y) * -0.5;
	} else if ((z * z) <= 1e+268) {
		tmp = t_0;
	} else {
		tmp = (z / y) * (z * -0.5);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (y + ((x * x) / y)) / 2.0
	tmp = 0
	if (z * z) <= 1e+53:
		tmp = t_0
	elif (z * z) <= 2e+173:
		tmp = ((z * z) / y) * -0.5
	elif (z * z) <= 1e+268:
		tmp = t_0
	else:
		tmp = (z / y) * (z * -0.5)
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(y + Float64(Float64(x * x) / y)) / 2.0)
	tmp = 0.0
	if (Float64(z * z) <= 1e+53)
		tmp = t_0;
	elseif (Float64(z * z) <= 2e+173)
		tmp = Float64(Float64(Float64(z * z) / y) * -0.5);
	elseif (Float64(z * z) <= 1e+268)
		tmp = t_0;
	else
		tmp = Float64(Float64(z / y) * Float64(z * -0.5));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (y + ((x * x) / y)) / 2.0;
	tmp = 0.0;
	if ((z * z) <= 1e+53)
		tmp = t_0;
	elseif ((z * z) <= 2e+173)
		tmp = ((z * z) / y) * -0.5;
	elseif ((z * z) <= 1e+268)
		tmp = t_0;
	else
		tmp = (z / y) * (z * -0.5);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y + N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 1e+53], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 2e+173], N[(N[(N[(z * z), $MachinePrecision] / y), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+268], t$95$0, N[(N[(z / y), $MachinePrecision] * N[(z * -0.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y + \frac{x \cdot x}{y}}{2}\\
\mathbf{if}\;z \cdot z \leq 10^{+53}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+173}:\\
\;\;\;\;\frac{z \cdot z}{y} \cdot -0.5\\

\mathbf{elif}\;z \cdot z \leq 10^{+268}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{z}{y} \cdot \left(z \cdot -0.5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z z) < 9.9999999999999999e52 or 2e173 < (*.f64 z z) < 9.9999999999999997e267

    1. Initial program 73.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
      6. div-subN/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
      9. *-inversesN/A

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
      15. *-lowering-*.f6490.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
    3. Simplified90.3%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(y + \frac{{x}^{2}}{y}\right)}, 2\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, \left(\frac{{x}^{2}}{y}\right)\right), 2\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, \mathsf{/.f64}\left(\left({x}^{2}\right), y\right)\right), 2\right) \]
      3. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), y\right)\right), 2\right) \]
    7. Simplified80.6%

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

    if 9.9999999999999999e52 < (*.f64 z z) < 2e173

    1. Initial program 91.7%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
      6. div-subN/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
      9. *-inversesN/A

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
      15. *-lowering-*.f6495.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
    3. Simplified95.8%

      \[\leadsto \color{blue}{\frac{y - \frac{z \cdot z - x \cdot x}{y}}{2}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-numN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \left(\frac{y}{z \cdot z - x \cdot x}\right)\right)\right), 2\right) \]
      3. difference-of-squaresN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{y}{z + x}\right), \left(z - x\right)\right)\right)\right), 2\right) \]
      6. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, \mathsf{+.f64}\left(z, x\right)\right), \left(z - x\right)\right)\right)\right), 2\right) \]
      8. --lowering--.f6499.6%

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

      \[\leadsto \frac{y - \color{blue}{\frac{1}{\frac{\frac{y}{z + x}}{z - x}}}}{2} \]
    7. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{{z}^{2}}{y}} \]
    8. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({z}^{2}\right), y\right), \frac{-1}{2}\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(z \cdot z\right), y\right), \frac{-1}{2}\right) \]
      5. *-lowering-*.f6470.6%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(z, z\right), y\right), \frac{-1}{2}\right) \]
    9. Simplified70.6%

      \[\leadsto \color{blue}{\frac{z \cdot z}{y} \cdot -0.5} \]

    if 9.9999999999999997e267 < (*.f64 z z)

    1. Initial program 60.9%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
      6. div-subN/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
      9. *-inversesN/A

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
      15. *-lowering-*.f6466.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
    3. Simplified66.9%

      \[\leadsto \color{blue}{\frac{y - \frac{z \cdot z - x \cdot x}{y}}{2}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-numN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \left(\frac{y}{z \cdot z - x \cdot x}\right)\right)\right), 2\right) \]
      3. difference-of-squaresN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{y}{z + x}\right), \left(z - x\right)\right)\right)\right), 2\right) \]
      6. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, \mathsf{+.f64}\left(z, x\right)\right), \left(z - x\right)\right)\right)\right), 2\right) \]
      8. --lowering--.f6499.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, \mathsf{+.f64}\left(z, x\right)\right), \mathsf{\_.f64}\left(z, x\right)\right)\right)\right), 2\right) \]
    6. Applied egg-rr99.9%

      \[\leadsto \frac{y - \color{blue}{\frac{1}{\frac{\frac{y}{z + x}}{z - x}}}}{2} \]
    7. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{{z}^{2}}{y}} \]
    8. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({z}^{2}\right), y\right), \frac{-1}{2}\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(z \cdot z\right), y\right), \frac{-1}{2}\right) \]
      5. *-lowering-*.f6473.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(z, z\right), y\right), \frac{-1}{2}\right) \]
    9. Simplified73.5%

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

        \[\leadsto \left(\frac{z}{y} \cdot z\right) \cdot \frac{-1}{2} \]
      2. associate-*l*N/A

        \[\leadsto \frac{z}{y} \cdot \color{blue}{\left(z \cdot \frac{-1}{2}\right)} \]
      3. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, y\right), \left(\color{blue}{z} \cdot \frac{-1}{2}\right)\right) \]
      5. *-lowering-*.f6479.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, y\right), \mathsf{*.f64}\left(z, \color{blue}{\frac{-1}{2}}\right)\right) \]
    11. Applied egg-rr79.8%

      \[\leadsto \color{blue}{\frac{z}{y} \cdot \left(z \cdot -0.5\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 43.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 7.6 \cdot 10^{-237}:\\ \;\;\;\;\frac{y}{2}\\ \mathbf{elif}\;z \leq 1.62 \cdot 10^{-77}:\\ \;\;\;\;\frac{0.5}{\frac{y}{x \cdot x}}\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{+21}:\\ \;\;\;\;\frac{y}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{y} \cdot \left(z \cdot -0.5\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z 7.6e-237)
   (/ y 2.0)
   (if (<= z 1.62e-77)
     (/ 0.5 (/ y (* x x)))
     (if (<= z 7.8e+21) (/ y 2.0) (* (/ z y) (* z -0.5))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= 7.6e-237) {
		tmp = y / 2.0;
	} else if (z <= 1.62e-77) {
		tmp = 0.5 / (y / (x * x));
	} else if (z <= 7.8e+21) {
		tmp = y / 2.0;
	} else {
		tmp = (z / y) * (z * -0.5);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= 7.6d-237) then
        tmp = y / 2.0d0
    else if (z <= 1.62d-77) then
        tmp = 0.5d0 / (y / (x * x))
    else if (z <= 7.8d+21) then
        tmp = y / 2.0d0
    else
        tmp = (z / y) * (z * (-0.5d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= 7.6e-237) {
		tmp = y / 2.0;
	} else if (z <= 1.62e-77) {
		tmp = 0.5 / (y / (x * x));
	} else if (z <= 7.8e+21) {
		tmp = y / 2.0;
	} else {
		tmp = (z / y) * (z * -0.5);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= 7.6e-237:
		tmp = y / 2.0
	elif z <= 1.62e-77:
		tmp = 0.5 / (y / (x * x))
	elif z <= 7.8e+21:
		tmp = y / 2.0
	else:
		tmp = (z / y) * (z * -0.5)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= 7.6e-237)
		tmp = Float64(y / 2.0);
	elseif (z <= 1.62e-77)
		tmp = Float64(0.5 / Float64(y / Float64(x * x)));
	elseif (z <= 7.8e+21)
		tmp = Float64(y / 2.0);
	else
		tmp = Float64(Float64(z / y) * Float64(z * -0.5));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= 7.6e-237)
		tmp = y / 2.0;
	elseif (z <= 1.62e-77)
		tmp = 0.5 / (y / (x * x));
	elseif (z <= 7.8e+21)
		tmp = y / 2.0;
	else
		tmp = (z / y) * (z * -0.5);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, 7.6e-237], N[(y / 2.0), $MachinePrecision], If[LessEqual[z, 1.62e-77], N[(0.5 / N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.8e+21], N[(y / 2.0), $MachinePrecision], N[(N[(z / y), $MachinePrecision] * N[(z * -0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq 7.6 \cdot 10^{-237}:\\
\;\;\;\;\frac{y}{2}\\

\mathbf{elif}\;z \leq 1.62 \cdot 10^{-77}:\\
\;\;\;\;\frac{0.5}{\frac{y}{x \cdot x}}\\

\mathbf{elif}\;z \leq 7.8 \cdot 10^{+21}:\\
\;\;\;\;\frac{y}{2}\\

\mathbf{else}:\\
\;\;\;\;\frac{z}{y} \cdot \left(z \cdot -0.5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 7.60000000000000047e-237 or 1.62000000000000006e-77 < z < 7.8e21

    1. Initial program 72.1%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
      6. div-subN/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
      9. *-inversesN/A

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
      15. *-lowering-*.f6485.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
    3. Simplified85.1%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{y}, 2\right) \]
    6. Step-by-step derivation
      1. Simplified32.5%

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

      if 7.60000000000000047e-237 < z < 1.62000000000000006e-77

      1. Initial program 87.0%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Step-by-step derivation
        1. associate-/r*N/A

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
        6. div-subN/A

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

          \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
        9. *-inversesN/A

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
        15. *-lowering-*.f6490.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
      3. Simplified90.8%

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

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{{x}^{2}}{y}\right)}, 2\right) \]
      6. Step-by-step derivation
        1. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(x \cdot x\right), y\right), 2\right) \]
        3. *-lowering-*.f6453.9%

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

        \[\leadsto \frac{\color{blue}{\frac{x \cdot x}{y}}}{2} \]
      8. Step-by-step derivation
        1. div-invN/A

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

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

          \[\leadsto \frac{1 \cdot \frac{1}{2}}{\color{blue}{\frac{y}{x \cdot x}}} \]
        4. metadata-evalN/A

          \[\leadsto \frac{1 \cdot \frac{1}{2}}{\frac{y}{x \cdot x}} \]
        5. metadata-evalN/A

          \[\leadsto \frac{\frac{1}{2}}{\frac{\color{blue}{y}}{x \cdot x}} \]
        6. metadata-evalN/A

          \[\leadsto \frac{\frac{1}{2}}{\frac{\color{blue}{y}}{x \cdot x}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{2}\right), \color{blue}{\left(\frac{y}{x \cdot x}\right)}\right) \]
        8. metadata-evalN/A

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

          \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(y, \color{blue}{\left(x \cdot x\right)}\right)\right) \]
        10. *-lowering-*.f6454.0%

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

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

      if 7.8e21 < z

      1. Initial program 59.7%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Step-by-step derivation
        1. associate-/r*N/A

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
        6. div-subN/A

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

          \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
        9. *-inversesN/A

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
        15. *-lowering-*.f6473.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
      3. Simplified73.1%

        \[\leadsto \color{blue}{\frac{y - \frac{z \cdot z - x \cdot x}{y}}{2}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. clear-numN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \left(\frac{y}{z \cdot z - x \cdot x}\right)\right)\right), 2\right) \]
        3. difference-of-squaresN/A

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{y}{z + x}\right), \left(z - x\right)\right)\right)\right), 2\right) \]
        6. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, \mathsf{+.f64}\left(z, x\right)\right), \left(z - x\right)\right)\right)\right), 2\right) \]
        8. --lowering--.f6499.9%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, \mathsf{+.f64}\left(z, x\right)\right), \mathsf{\_.f64}\left(z, x\right)\right)\right)\right), 2\right) \]
      6. Applied egg-rr99.9%

        \[\leadsto \frac{y - \color{blue}{\frac{1}{\frac{\frac{y}{z + x}}{z - x}}}}{2} \]
      7. Taylor expanded in z around inf

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{{z}^{2}}{y}} \]
      8. Step-by-step derivation
        1. *-commutativeN/A

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({z}^{2}\right), y\right), \frac{-1}{2}\right) \]
        4. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(z \cdot z\right), y\right), \frac{-1}{2}\right) \]
        5. *-lowering-*.f6460.3%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(z, z\right), y\right), \frac{-1}{2}\right) \]
      9. Simplified60.3%

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

          \[\leadsto \left(\frac{z}{y} \cdot z\right) \cdot \frac{-1}{2} \]
        2. associate-*l*N/A

          \[\leadsto \frac{z}{y} \cdot \color{blue}{\left(z \cdot \frac{-1}{2}\right)} \]
        3. *-lowering-*.f64N/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, y\right), \left(\color{blue}{z} \cdot \frac{-1}{2}\right)\right) \]
        5. *-lowering-*.f6466.7%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, y\right), \mathsf{*.f64}\left(z, \color{blue}{\frac{-1}{2}}\right)\right) \]
      11. Applied egg-rr66.7%

        \[\leadsto \color{blue}{\frac{z}{y} \cdot \left(z \cdot -0.5\right)} \]
    7. Recombined 3 regimes into one program.
    8. Add Preprocessing

    Alternative 4: 43.4% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 7.2 \cdot 10^{-237}:\\ \;\;\;\;\frac{y}{2}\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-74}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y}\\ \mathbf{elif}\;z \leq 8 \cdot 10^{+21}:\\ \;\;\;\;\frac{y}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{y} \cdot \left(z \cdot -0.5\right)\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= z 7.2e-237)
       (/ y 2.0)
       (if (<= z 5.4e-74)
         (* (* x x) (/ 0.5 y))
         (if (<= z 8e+21) (/ y 2.0) (* (/ z y) (* z -0.5))))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (z <= 7.2e-237) {
    		tmp = y / 2.0;
    	} else if (z <= 5.4e-74) {
    		tmp = (x * x) * (0.5 / y);
    	} else if (z <= 8e+21) {
    		tmp = y / 2.0;
    	} else {
    		tmp = (z / y) * (z * -0.5);
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8) :: tmp
        if (z <= 7.2d-237) then
            tmp = y / 2.0d0
        else if (z <= 5.4d-74) then
            tmp = (x * x) * (0.5d0 / y)
        else if (z <= 8d+21) then
            tmp = y / 2.0d0
        else
            tmp = (z / y) * (z * (-0.5d0))
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double tmp;
    	if (z <= 7.2e-237) {
    		tmp = y / 2.0;
    	} else if (z <= 5.4e-74) {
    		tmp = (x * x) * (0.5 / y);
    	} else if (z <= 8e+21) {
    		tmp = y / 2.0;
    	} else {
    		tmp = (z / y) * (z * -0.5);
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	tmp = 0
    	if z <= 7.2e-237:
    		tmp = y / 2.0
    	elif z <= 5.4e-74:
    		tmp = (x * x) * (0.5 / y)
    	elif z <= 8e+21:
    		tmp = y / 2.0
    	else:
    		tmp = (z / y) * (z * -0.5)
    	return tmp
    
    function code(x, y, z)
    	tmp = 0.0
    	if (z <= 7.2e-237)
    		tmp = Float64(y / 2.0);
    	elseif (z <= 5.4e-74)
    		tmp = Float64(Float64(x * x) * Float64(0.5 / y));
    	elseif (z <= 8e+21)
    		tmp = Float64(y / 2.0);
    	else
    		tmp = Float64(Float64(z / y) * Float64(z * -0.5));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	tmp = 0.0;
    	if (z <= 7.2e-237)
    		tmp = y / 2.0;
    	elseif (z <= 5.4e-74)
    		tmp = (x * x) * (0.5 / y);
    	elseif (z <= 8e+21)
    		tmp = y / 2.0;
    	else
    		tmp = (z / y) * (z * -0.5);
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := If[LessEqual[z, 7.2e-237], N[(y / 2.0), $MachinePrecision], If[LessEqual[z, 5.4e-74], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e+21], N[(y / 2.0), $MachinePrecision], N[(N[(z / y), $MachinePrecision] * N[(z * -0.5), $MachinePrecision]), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq 7.2 \cdot 10^{-237}:\\
    \;\;\;\;\frac{y}{2}\\
    
    \mathbf{elif}\;z \leq 5.4 \cdot 10^{-74}:\\
    \;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y}\\
    
    \mathbf{elif}\;z \leq 8 \cdot 10^{+21}:\\
    \;\;\;\;\frac{y}{2}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{z}{y} \cdot \left(z \cdot -0.5\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z < 7.19999999999999993e-237 or 5.40000000000000036e-74 < z < 8e21

      1. Initial program 72.1%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Step-by-step derivation
        1. associate-/r*N/A

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
        6. div-subN/A

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

          \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
        9. *-inversesN/A

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
        15. *-lowering-*.f6485.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
      3. Simplified85.1%

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

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{y}, 2\right) \]
      6. Step-by-step derivation
        1. Simplified32.5%

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

        if 7.19999999999999993e-237 < z < 5.40000000000000036e-74

        1. Initial program 87.0%

          \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
        2. Step-by-step derivation
          1. associate-/r*N/A

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
          6. div-subN/A

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

            \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
          8. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
          9. *-inversesN/A

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
          15. *-lowering-*.f6490.8%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
        3. Simplified90.8%

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

          \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{{x}^{2}}{y}\right)}, 2\right) \]
        6. Step-by-step derivation
          1. /-lowering-/.f64N/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(x \cdot x\right), y\right), 2\right) \]
          3. *-lowering-*.f6453.9%

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

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

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

            \[\leadsto \left(x \cdot x\right) \cdot \color{blue}{\frac{1}{y \cdot 2}} \]
          3. *-lowering-*.f64N/A

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\left(\frac{1}{2}\right), \color{blue}{y}\right)\right) \]
          8. metadata-eval54.0%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\frac{1}{2}, y\right)\right) \]
        9. Applied egg-rr54.0%

          \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \frac{0.5}{y}} \]

        if 8e21 < z

        1. Initial program 59.7%

          \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
        2. Step-by-step derivation
          1. associate-/r*N/A

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
          6. div-subN/A

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

            \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
          8. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
          9. *-inversesN/A

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
          15. *-lowering-*.f6473.1%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
        3. Simplified73.1%

          \[\leadsto \color{blue}{\frac{y - \frac{z \cdot z - x \cdot x}{y}}{2}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. clear-numN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \left(\frac{y}{z \cdot z - x \cdot x}\right)\right)\right), 2\right) \]
          3. difference-of-squaresN/A

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{y}{z + x}\right), \left(z - x\right)\right)\right)\right), 2\right) \]
          6. /-lowering-/.f64N/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, \mathsf{+.f64}\left(z, x\right)\right), \left(z - x\right)\right)\right)\right), 2\right) \]
          8. --lowering--.f6499.9%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, \mathsf{+.f64}\left(z, x\right)\right), \mathsf{\_.f64}\left(z, x\right)\right)\right)\right), 2\right) \]
        6. Applied egg-rr99.9%

          \[\leadsto \frac{y - \color{blue}{\frac{1}{\frac{\frac{y}{z + x}}{z - x}}}}{2} \]
        7. Taylor expanded in z around inf

          \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{{z}^{2}}{y}} \]
        8. Step-by-step derivation
          1. *-commutativeN/A

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({z}^{2}\right), y\right), \frac{-1}{2}\right) \]
          4. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(z \cdot z\right), y\right), \frac{-1}{2}\right) \]
          5. *-lowering-*.f6460.3%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(z, z\right), y\right), \frac{-1}{2}\right) \]
        9. Simplified60.3%

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

            \[\leadsto \left(\frac{z}{y} \cdot z\right) \cdot \frac{-1}{2} \]
          2. associate-*l*N/A

            \[\leadsto \frac{z}{y} \cdot \color{blue}{\left(z \cdot \frac{-1}{2}\right)} \]
          3. *-lowering-*.f64N/A

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, y\right), \left(\color{blue}{z} \cdot \frac{-1}{2}\right)\right) \]
          5. *-lowering-*.f6466.7%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, y\right), \mathsf{*.f64}\left(z, \color{blue}{\frac{-1}{2}}\right)\right) \]
        11. Applied egg-rr66.7%

          \[\leadsto \color{blue}{\frac{z}{y} \cdot \left(z \cdot -0.5\right)} \]
      7. Recombined 3 regimes into one program.
      8. Add Preprocessing

      Alternative 5: 52.5% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{-156}:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{2}\\ \mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+43}:\\ \;\;\;\;\frac{y}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{y} \cdot \left(z \cdot -0.5\right)\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (<= (* z z) 1e-156)
         (/ (* x (/ x y)) 2.0)
         (if (<= (* z z) 5e+43) (/ y 2.0) (* (/ z y) (* z -0.5)))))
      double code(double x, double y, double z) {
      	double tmp;
      	if ((z * z) <= 1e-156) {
      		tmp = (x * (x / y)) / 2.0;
      	} else if ((z * z) <= 5e+43) {
      		tmp = y / 2.0;
      	} else {
      		tmp = (z / y) * (z * -0.5);
      	}
      	return tmp;
      }
      
      real(8) function code(x, y, z)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8) :: tmp
          if ((z * z) <= 1d-156) then
              tmp = (x * (x / y)) / 2.0d0
          else if ((z * z) <= 5d+43) then
              tmp = y / 2.0d0
          else
              tmp = (z / y) * (z * (-0.5d0))
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double tmp;
      	if ((z * z) <= 1e-156) {
      		tmp = (x * (x / y)) / 2.0;
      	} else if ((z * z) <= 5e+43) {
      		tmp = y / 2.0;
      	} else {
      		tmp = (z / y) * (z * -0.5);
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	tmp = 0
      	if (z * z) <= 1e-156:
      		tmp = (x * (x / y)) / 2.0
      	elif (z * z) <= 5e+43:
      		tmp = y / 2.0
      	else:
      		tmp = (z / y) * (z * -0.5)
      	return tmp
      
      function code(x, y, z)
      	tmp = 0.0
      	if (Float64(z * z) <= 1e-156)
      		tmp = Float64(Float64(x * Float64(x / y)) / 2.0);
      	elseif (Float64(z * z) <= 5e+43)
      		tmp = Float64(y / 2.0);
      	else
      		tmp = Float64(Float64(z / y) * Float64(z * -0.5));
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	tmp = 0.0;
      	if ((z * z) <= 1e-156)
      		tmp = (x * (x / y)) / 2.0;
      	elseif ((z * z) <= 5e+43)
      		tmp = y / 2.0;
      	else
      		tmp = (z / y) * (z * -0.5);
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e-156], N[(N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+43], N[(y / 2.0), $MachinePrecision], N[(N[(z / y), $MachinePrecision] * N[(z * -0.5), $MachinePrecision]), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;z \cdot z \leq 10^{-156}:\\
      \;\;\;\;\frac{x \cdot \frac{x}{y}}{2}\\
      
      \mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+43}:\\
      \;\;\;\;\frac{y}{2}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{z}{y} \cdot \left(z \cdot -0.5\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (*.f64 z z) < 1.00000000000000004e-156

        1. Initial program 80.1%

          \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
        2. Step-by-step derivation
          1. associate-/r*N/A

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
          6. div-subN/A

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

            \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
          8. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
          9. *-inversesN/A

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
          15. *-lowering-*.f6490.9%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
        3. Simplified90.9%

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

          \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{{x}^{2}}{y}\right)}, 2\right) \]
        6. Step-by-step derivation
          1. /-lowering-/.f64N/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(x \cdot x\right), y\right), 2\right) \]
          3. *-lowering-*.f6452.4%

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(x \cdot \frac{x}{y}\right), 2\right) \]
          2. *-commutativeN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\frac{x}{y}\right), x\right), 2\right) \]
          4. /-lowering-/.f6455.5%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), x\right), 2\right) \]
        9. Applied egg-rr55.5%

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

        if 1.00000000000000004e-156 < (*.f64 z z) < 5.0000000000000004e43

        1. Initial program 66.9%

          \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
        2. Step-by-step derivation
          1. associate-/r*N/A

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
          6. div-subN/A

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

            \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
          8. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
          9. *-inversesN/A

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
          15. *-lowering-*.f6488.3%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
        3. Simplified88.3%

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

          \[\leadsto \mathsf{/.f64}\left(\color{blue}{y}, 2\right) \]
        6. Step-by-step derivation
          1. Simplified52.8%

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

          if 5.0000000000000004e43 < (*.f64 z z)

          1. Initial program 65.6%

            \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
          2. Step-by-step derivation
            1. associate-/r*N/A

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
            6. div-subN/A

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

              \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            9. *-inversesN/A

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
            15. *-lowering-*.f6476.0%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
          3. Simplified76.0%

            \[\leadsto \color{blue}{\frac{y - \frac{z \cdot z - x \cdot x}{y}}{2}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. clear-numN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \left(\frac{y}{z \cdot z - x \cdot x}\right)\right)\right), 2\right) \]
            3. difference-of-squaresN/A

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{y}{z + x}\right), \left(z - x\right)\right)\right)\right), 2\right) \]
            6. /-lowering-/.f64N/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, \mathsf{+.f64}\left(z, x\right)\right), \left(z - x\right)\right)\right)\right), 2\right) \]
            8. --lowering--.f6499.9%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, \mathsf{+.f64}\left(z, x\right)\right), \mathsf{\_.f64}\left(z, x\right)\right)\right)\right), 2\right) \]
          6. Applied egg-rr99.9%

            \[\leadsto \frac{y - \color{blue}{\frac{1}{\frac{\frac{y}{z + x}}{z - x}}}}{2} \]
          7. Taylor expanded in z around inf

            \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{{z}^{2}}{y}} \]
          8. Step-by-step derivation
            1. *-commutativeN/A

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({z}^{2}\right), y\right), \frac{-1}{2}\right) \]
            4. unpow2N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(z \cdot z\right), y\right), \frac{-1}{2}\right) \]
            5. *-lowering-*.f6464.5%

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(z, z\right), y\right), \frac{-1}{2}\right) \]
          9. Simplified64.5%

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

              \[\leadsto \left(\frac{z}{y} \cdot z\right) \cdot \frac{-1}{2} \]
            2. associate-*l*N/A

              \[\leadsto \frac{z}{y} \cdot \color{blue}{\left(z \cdot \frac{-1}{2}\right)} \]
            3. *-lowering-*.f64N/A

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, y\right), \left(\color{blue}{z} \cdot \frac{-1}{2}\right)\right) \]
            5. *-lowering-*.f6468.7%

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, y\right), \mathsf{*.f64}\left(z, \color{blue}{\frac{-1}{2}}\right)\right) \]
          11. Applied egg-rr68.7%

            \[\leadsto \color{blue}{\frac{z}{y} \cdot \left(z \cdot -0.5\right)} \]
        7. Recombined 3 regimes into one program.
        8. Final simplification61.8%

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{-156}:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{2}\\ \mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+43}:\\ \;\;\;\;\frac{y}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{y} \cdot \left(z \cdot -0.5\right)\\ \end{array} \]
        9. Add Preprocessing

        Alternative 6: 76.1% accurate, 0.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 9 \cdot 10^{+56}:\\ \;\;\;\;\frac{\left(z + x\right) \cdot \frac{x - z}{y}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - z \cdot \frac{z}{y}}{2}\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y 9e+56)
           (/ (* (+ z x) (/ (- x z) y)) 2.0)
           (/ (- y (* z (/ z y))) 2.0)))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= 9e+56) {
        		tmp = ((z + x) * ((x - z) / y)) / 2.0;
        	} else {
        		tmp = (y - (z * (z / y))) / 2.0;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if (y <= 9d+56) then
                tmp = ((z + x) * ((x - z) / y)) / 2.0d0
            else
                tmp = (y - (z * (z / y))) / 2.0d0
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (y <= 9e+56) {
        		tmp = ((z + x) * ((x - z) / y)) / 2.0;
        	} else {
        		tmp = (y - (z * (z / y))) / 2.0;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= 9e+56:
        		tmp = ((z + x) * ((x - z) / y)) / 2.0
        	else:
        		tmp = (y - (z * (z / y))) / 2.0
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= 9e+56)
        		tmp = Float64(Float64(Float64(z + x) * Float64(Float64(x - z) / y)) / 2.0);
        	else
        		tmp = Float64(Float64(y - Float64(z * Float64(z / y))) / 2.0);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (y <= 9e+56)
        		tmp = ((z + x) * ((x - z) / y)) / 2.0;
        	else
        		tmp = (y - (z * (z / y))) / 2.0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, 9e+56], N[(N[(N[(z + x), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(y - N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq 9 \cdot 10^{+56}:\\
        \;\;\;\;\frac{\left(z + x\right) \cdot \frac{x - z}{y}}{2}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{y - z \cdot \frac{z}{y}}{2}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < 9.0000000000000006e56

          1. Initial program 75.7%

            \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
          2. Step-by-step derivation
            1. associate-/r*N/A

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
            6. div-subN/A

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

              \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            9. *-inversesN/A

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
            15. *-lowering-*.f6483.6%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
          3. Simplified83.6%

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

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{{x}^{2} - {z}^{2}}{y}\right)}, 2\right) \]
          6. Step-by-step derivation
            1. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{x \cdot x - {z}^{2}}{y}\right), 2\right) \]
            2. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{x \cdot x - z \cdot z}{y}\right), 2\right) \]
            3. difference-of-squaresN/A

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, z\right), \mathsf{/.f64}\left(\left(x - z\right), y\right)\right), 2\right) \]
            8. --lowering--.f6479.6%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, z\right), \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x, z\right), y\right)\right), 2\right) \]
          7. Simplified79.6%

            \[\leadsto \frac{\color{blue}{\left(x + z\right) \cdot \frac{x - z}{y}}}{2} \]

          if 9.0000000000000006e56 < y

          1. Initial program 44.9%

            \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
          2. Step-by-step derivation
            1. associate-/r*N/A

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
            6. div-subN/A

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

              \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            9. *-inversesN/A

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
            15. *-lowering-*.f6479.3%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
          3. Simplified79.3%

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

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(y - \frac{{z}^{2}}{y}\right)}, 2\right) \]
          6. Step-by-step derivation
            1. --lowering--.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \left(\frac{{z}^{2}}{y}\right)\right), 2\right) \]
            2. /-lowering-/.f64N/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\left(z \cdot z\right), y\right)\right), 2\right) \]
            4. *-lowering-*.f6475.4%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{*.f64}\left(z, z\right), y\right)\right), 2\right) \]
          7. Simplified75.4%

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \left(z \cdot \frac{z}{y}\right)\right), 2\right) \]
            2. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \left(\frac{z}{y} \cdot z\right)\right), 2\right) \]
            3. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{*.f64}\left(\left(\frac{z}{y}\right), z\right)\right), 2\right) \]
            4. /-lowering-/.f6484.6%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, y\right), z\right)\right), 2\right) \]
          9. Applied egg-rr84.6%

            \[\leadsto \frac{y - \color{blue}{\frac{z}{y} \cdot z}}{2} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification80.4%

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 9 \cdot 10^{+56}:\\ \;\;\;\;\frac{\left(z + x\right) \cdot \frac{x - z}{y}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - z \cdot \frac{z}{y}}{2}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 7: 81.8% accurate, 0.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 4 \cdot 10^{-11}:\\ \;\;\;\;\frac{y + \frac{x \cdot x}{y}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - z \cdot \frac{z}{y}}{2}\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= (* z z) 4e-11)
           (/ (+ y (/ (* x x) y)) 2.0)
           (/ (- y (* z (/ z y))) 2.0)))
        double code(double x, double y, double z) {
        	double tmp;
        	if ((z * z) <= 4e-11) {
        		tmp = (y + ((x * x) / y)) / 2.0;
        	} else {
        		tmp = (y - (z * (z / y))) / 2.0;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if ((z * z) <= 4d-11) then
                tmp = (y + ((x * x) / y)) / 2.0d0
            else
                tmp = (y - (z * (z / y))) / 2.0d0
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if ((z * z) <= 4e-11) {
        		tmp = (y + ((x * x) / y)) / 2.0;
        	} else {
        		tmp = (y - (z * (z / y))) / 2.0;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if (z * z) <= 4e-11:
        		tmp = (y + ((x * x) / y)) / 2.0
        	else:
        		tmp = (y - (z * (z / y))) / 2.0
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (Float64(z * z) <= 4e-11)
        		tmp = Float64(Float64(y + Float64(Float64(x * x) / y)) / 2.0);
        	else
        		tmp = Float64(Float64(y - Float64(z * Float64(z / y))) / 2.0);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if ((z * z) <= 4e-11)
        		tmp = (y + ((x * x) / y)) / 2.0;
        	else
        		tmp = (y - (z * (z / y))) / 2.0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e-11], N[(N[(y + N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(y - N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \cdot z \leq 4 \cdot 10^{-11}:\\
        \;\;\;\;\frac{y + \frac{x \cdot x}{y}}{2}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{y - z \cdot \frac{z}{y}}{2}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f64 z z) < 3.99999999999999976e-11

          1. Initial program 77.3%

            \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
          2. Step-by-step derivation
            1. associate-/r*N/A

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
            6. div-subN/A

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

              \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            9. *-inversesN/A

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
            15. *-lowering-*.f6491.7%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
          3. Simplified91.7%

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

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(y + \frac{{x}^{2}}{y}\right)}, 2\right) \]
          6. Step-by-step derivation
            1. +-lowering-+.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, \left(\frac{{x}^{2}}{y}\right)\right), 2\right) \]
            2. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, \mathsf{/.f64}\left(\left({x}^{2}\right), y\right)\right), 2\right) \]
            3. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, \mathsf{/.f64}\left(\left(x \cdot x\right), y\right)\right), 2\right) \]
            4. *-lowering-*.f6485.3%

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

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

          if 3.99999999999999976e-11 < (*.f64 z z)

          1. Initial program 65.2%

            \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
          2. Step-by-step derivation
            1. associate-/r*N/A

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
            6. div-subN/A

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

              \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            9. *-inversesN/A

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
            15. *-lowering-*.f6475.5%

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

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

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(y - \frac{{z}^{2}}{y}\right)}, 2\right) \]
          6. Step-by-step derivation
            1. --lowering--.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \left(\frac{{z}^{2}}{y}\right)\right), 2\right) \]
            2. /-lowering-/.f64N/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\left(z \cdot z\right), y\right)\right), 2\right) \]
            4. *-lowering-*.f6473.6%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{*.f64}\left(z, z\right), y\right)\right), 2\right) \]
          7. Simplified73.6%

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \left(z \cdot \frac{z}{y}\right)\right), 2\right) \]
            2. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \left(\frac{z}{y} \cdot z\right)\right), 2\right) \]
            3. *-lowering-*.f64N/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, y\right), z\right)\right), 2\right) \]
          9. Applied egg-rr82.5%

            \[\leadsto \frac{y - \color{blue}{\frac{z}{y} \cdot z}}{2} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification83.8%

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

        Alternative 8: 42.4% accurate, 1.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.65 \cdot 10^{+59}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{2}\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y 1.65e+59) (* (* x x) (/ 0.5 y)) (/ y 2.0)))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= 1.65e+59) {
        		tmp = (x * x) * (0.5 / y);
        	} else {
        		tmp = y / 2.0;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if (y <= 1.65d+59) then
                tmp = (x * x) * (0.5d0 / y)
            else
                tmp = y / 2.0d0
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (y <= 1.65e+59) {
        		tmp = (x * x) * (0.5 / y);
        	} else {
        		tmp = y / 2.0;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= 1.65e+59:
        		tmp = (x * x) * (0.5 / y)
        	else:
        		tmp = y / 2.0
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= 1.65e+59)
        		tmp = Float64(Float64(x * x) * Float64(0.5 / y));
        	else
        		tmp = Float64(y / 2.0);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (y <= 1.65e+59)
        		tmp = (x * x) * (0.5 / y);
        	else
        		tmp = y / 2.0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, 1.65e+59], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y), $MachinePrecision]), $MachinePrecision], N[(y / 2.0), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq 1.65 \cdot 10^{+59}:\\
        \;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{y}{2}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < 1.65e59

          1. Initial program 75.7%

            \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
          2. Step-by-step derivation
            1. associate-/r*N/A

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
            6. div-subN/A

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

              \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            9. *-inversesN/A

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
            15. *-lowering-*.f6483.6%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
          3. Simplified83.6%

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

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{{x}^{2}}{y}\right)}, 2\right) \]
          6. Step-by-step derivation
            1. /-lowering-/.f64N/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(x \cdot x\right), y\right), 2\right) \]
            3. *-lowering-*.f6433.5%

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

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

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

              \[\leadsto \left(x \cdot x\right) \cdot \color{blue}{\frac{1}{y \cdot 2}} \]
            3. *-lowering-*.f64N/A

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

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

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

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\frac{1}{2}, y\right)\right) \]
          9. Applied egg-rr33.5%

            \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \frac{0.5}{y}} \]

          if 1.65e59 < y

          1. Initial program 44.9%

            \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
          2. Step-by-step derivation
            1. associate-/r*N/A

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
            6. div-subN/A

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

              \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            9. *-inversesN/A

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
            15. *-lowering-*.f6479.3%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
          3. Simplified79.3%

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

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{y}, 2\right) \]
          6. Step-by-step derivation
            1. Simplified70.2%

              \[\leadsto \frac{\color{blue}{y}}{2} \]
          7. Recombined 2 regimes into one program.
          8. Add Preprocessing

          Alternative 9: 34.9% accurate, 5.0× speedup?

          \[\begin{array}{l} \\ \frac{y}{2} \end{array} \]
          (FPCore (x y z) :precision binary64 (/ y 2.0))
          double code(double x, double y, double z) {
          	return y / 2.0;
          }
          
          real(8) function code(x, y, z)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              code = y / 2.0d0
          end function
          
          public static double code(double x, double y, double z) {
          	return y / 2.0;
          }
          
          def code(x, y, z):
          	return y / 2.0
          
          function code(x, y, z)
          	return Float64(y / 2.0)
          end
          
          function tmp = code(x, y, z)
          	tmp = y / 2.0;
          end
          
          code[x_, y_, z_] := N[(y / 2.0), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \frac{y}{2}
          \end{array}
          
          Derivation
          1. Initial program 70.7%

            \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
          2. Step-by-step derivation
            1. associate-/r*N/A

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot y - \left(z \cdot z - x \cdot x\right)}{y}\right), 2\right) \]
            6. div-subN/A

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

              \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{y}{y} - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{y}{y} \cdot y - \frac{z \cdot z - x \cdot x}{y}\right), 2\right) \]
            9. *-inversesN/A

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(x \cdot x\right)\right), y\right)\right), 2\right) \]
            15. *-lowering-*.f6482.9%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(x, x\right)\right), y\right)\right), 2\right) \]
          3. Simplified82.9%

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

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{y}, 2\right) \]
          6. Step-by-step derivation
            1. Simplified29.9%

              \[\leadsto \frac{\color{blue}{y}}{2} \]
            2. Add Preprocessing

            Developer Target 1: 99.9% accurate, 1.0× speedup?

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

            Reproduce

            ?
            herbie shell --seed 2024161 
            (FPCore (x y z)
              :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
              :precision binary64
            
              :alt
              (! :herbie-platform default (- (* y 1/2) (* (* (/ 1/2 y) (+ z x)) (- z x))))
            
              (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))