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

Percentage Accurate: 69.5% → 99.9%
Time: 11.6s
Alternatives: 11
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 11 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: 69.5% 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} x_m = \left|x\right| \\ z_m = \left|z\right| \\ 0.5 \cdot \left(y + \left(x\_m + z\_m\right) \cdot \frac{x\_m - z\_m}{y}\right) \end{array} \]
x_m = (fabs.f64 x)
z_m = (fabs.f64 z)
(FPCore (x_m y z_m)
 :precision binary64
 (* 0.5 (+ y (* (+ x_m z_m) (/ (- x_m z_m) y)))))
x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m) {
	return 0.5 * (y + ((x_m + z_m) * ((x_m - z_m) / y)));
}
x_m = abs(x)
z_m = abs(z)
real(8) function code(x_m, y, z_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    code = 0.5d0 * (y + ((x_m + z_m) * ((x_m - z_m) / y)))
end function
x_m = Math.abs(x);
z_m = Math.abs(z);
public static double code(double x_m, double y, double z_m) {
	return 0.5 * (y + ((x_m + z_m) * ((x_m - z_m) / y)));
}
x_m = math.fabs(x)
z_m = math.fabs(z)
def code(x_m, y, z_m):
	return 0.5 * (y + ((x_m + z_m) * ((x_m - z_m) / y)))
x_m = abs(x)
z_m = abs(z)
function code(x_m, y, z_m)
	return Float64(0.5 * Float64(y + Float64(Float64(x_m + z_m) * Float64(Float64(x_m - z_m) / y))))
end
x_m = abs(x);
z_m = abs(z);
function tmp = code(x_m, y, z_m)
	tmp = 0.5 * (y + ((x_m + z_m) * ((x_m - z_m) / y)));
end
x_m = N[Abs[x], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
code[x$95$m_, y_, z$95$m_] := N[(0.5 * N[(y + N[(N[(x$95$m + z$95$m), $MachinePrecision] * N[(N[(x$95$m - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|

\\
0.5 \cdot \left(y + \left(x\_m + z\_m\right) \cdot \frac{x\_m - z\_m}{y}\right)
\end{array}
Derivation
  1. Initial program 70.8%

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, y\right), \mathsf{/.f64}\left(2, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(\color{blue}{z} \cdot z\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f6470.7%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, y\right), \mathsf{/.f64}\left(2, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(z, \color{blue}{z}\right)\right)\right)\right)\right) \]
  4. Applied egg-rr70.7%

    \[\leadsto \color{blue}{\frac{\frac{1}{y}}{\frac{2}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}} \]
  5. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{{y}^{2} - {z}^{2}}{y} + \frac{1}{2} \cdot \frac{{x}^{2}}{y}} \]
  6. Step-by-step derivation
    1. distribute-lft-outN/A

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

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

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\left(\frac{{y}^{2}}{y} - \frac{{z}^{2}}{y}\right) + \frac{\color{blue}{{x}^{2}}}{y}\right)\right) \]
    4. sub-negN/A

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(y \cdot \frac{y}{y} + \left(\color{blue}{\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right)} + \frac{{x}^{2}}{y}\right)\right)\right) \]
    8. *-inversesN/A

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(y \cdot 1 + \left(\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right) + \frac{{x}^{2}}{y}\right)\right)\right) \]
    9. *-rgt-identityN/A

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(y + \left(\color{blue}{\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right)} + \frac{{x}^{2}}{y}\right)\right)\right) \]
    10. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(y + \left(\frac{{x}^{2}}{y} + \color{blue}{\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right)}\right)\right)\right) \]
    11. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{0.5 \cdot \left(y + \left(x + z\right) \cdot \frac{x - z}{y}\right)} \]
  8. Add Preprocessing

Alternative 2: 90.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 10^{-117}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x\_m}{\frac{y}{x\_m}}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 1.00000000000000003e-117

    1. Initial program 76.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{{x}^{2} + {y}^{2}}{y}} \]
    4. Step-by-step derivation
      1. *-lft-identityN/A

        \[\leadsto \frac{1}{2} \cdot \frac{1 \cdot {x}^{2} + {y}^{2}}{y} \]
      2. *-inversesN/A

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

        \[\leadsto \frac{1}{2} \cdot \frac{\frac{{y}^{2} \cdot {x}^{2}}{{y}^{2}} + {y}^{2}}{y} \]
      4. associate-*r/N/A

        \[\leadsto \frac{1}{2} \cdot \frac{{y}^{2} \cdot \frac{{x}^{2}}{{y}^{2}} + {y}^{2}}{y} \]
      5. *-rgt-identityN/A

        \[\leadsto \frac{1}{2} \cdot \frac{{y}^{2} \cdot \frac{{x}^{2}}{{y}^{2}} + {y}^{2} \cdot 1}{y} \]
      6. distribute-lft-inN/A

        \[\leadsto \frac{1}{2} \cdot \frac{{y}^{2} \cdot \left(\frac{{x}^{2}}{{y}^{2}} + 1\right)}{y} \]
      7. +-commutativeN/A

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

        \[\leadsto \frac{1}{2} \cdot \left(\frac{{y}^{2}}{y} \cdot \color{blue}{\left(1 + \frac{{x}^{2}}{{y}^{2}}\right)}\right) \]
      9. unpow2N/A

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

        \[\leadsto \frac{1}{2} \cdot \left(\left(y \cdot \frac{y}{y}\right) \cdot \left(\color{blue}{1} + \frac{{x}^{2}}{{y}^{2}}\right)\right) \]
      11. *-inversesN/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(y \cdot 1\right) \cdot \left(1 + \frac{{x}^{2}}{{y}^{2}}\right)\right) \]
      12. *-rgt-identityN/A

        \[\leadsto \frac{1}{2} \cdot \left(y \cdot \left(\color{blue}{1} + \frac{{x}^{2}}{{y}^{2}}\right)\right) \]
      13. distribute-lft-inN/A

        \[\leadsto \frac{1}{2} \cdot \left(y \cdot 1 + \color{blue}{y \cdot \frac{{x}^{2}}{{y}^{2}}}\right) \]
      14. *-rgt-identityN/A

        \[\leadsto \frac{1}{2} \cdot \left(y + \color{blue}{y} \cdot \frac{{x}^{2}}{{y}^{2}}\right) \]
      15. *-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{{y}^{2}} \cdot \color{blue}{y}\right) \]
      16. associate-/r/N/A

        \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{\color{blue}{\frac{{y}^{2}}{y}}}\right) \]
      17. unpow2N/A

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

        \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{y \cdot \color{blue}{\frac{y}{y}}}\right) \]
      19. *-inversesN/A

        \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{y \cdot 1}\right) \]
      20. *-rgt-identityN/A

        \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{y}\right) \]
    5. Simplified91.9%

      \[\leadsto \color{blue}{0.5 \cdot \left(y + \frac{x \cdot x}{y}\right)} \]
    6. Step-by-step derivation
      1. associate-/l*N/A

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

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

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

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

      \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{x}{y} \cdot x}\right) \]
    8. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

    if 1.00000000000000003e-117 < (*.f64 z z)

    1. Initial program 67.1%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, y\right), \mathsf{/.f64}\left(2, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(\color{blue}{z} \cdot z\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f6467.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, y\right), \mathsf{/.f64}\left(2, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(z, \color{blue}{z}\right)\right)\right)\right)\right) \]
    4. Applied egg-rr67.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{\frac{2}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}} \]
    5. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{{y}^{2} - {z}^{2}}{y} + \frac{1}{2} \cdot \frac{{x}^{2}}{y}} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\left(\frac{{y}^{2}}{y} - \frac{{z}^{2}}{y}\right) + \frac{\color{blue}{{x}^{2}}}{y}\right)\right) \]
      4. sub-negN/A

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(y \cdot \frac{y}{y} + \left(\color{blue}{\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right)} + \frac{{x}^{2}}{y}\right)\right)\right) \]
      8. *-inversesN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(y \cdot 1 + \left(\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right) + \frac{{x}^{2}}{y}\right)\right)\right) \]
      9. *-rgt-identityN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(y + \left(\color{blue}{\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right)} + \frac{{x}^{2}}{y}\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(y + \left(\frac{{x}^{2}}{y} + \color{blue}{\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right)}\right)\right)\right) \]
      11. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(y + \left(x + z\right) \cdot \frac{x - z}{y}\right)} \]
    8. Taylor expanded in x around 0

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(y, \mathsf{*.f64}\left(\color{blue}{z}, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x, z\right), y\right)\right)\right)\right) \]
    9. Step-by-step derivation
      1. Simplified78.3%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{z} \cdot \frac{x - z}{y}\right) \]
    10. Recombined 2 regimes into one program.
    11. Add Preprocessing

    Alternative 3: 43.4% accurate, 0.9× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;y \leq 4 \cdot 10^{-53}:\\ \;\;\;\;\frac{x\_m}{y} \cdot \left(0.5 \cdot x\_m\right)\\ \mathbf{elif}\;y \leq 0.00018:\\ \;\;\;\;\frac{z\_m}{\frac{\frac{y}{z\_m}}{-0.5}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    z_m = (fabs.f64 z)
    (FPCore (x_m y z_m)
     :precision binary64
     (if (<= y 4e-53)
       (* (/ x_m y) (* 0.5 x_m))
       (if (<= y 0.00018) (/ z_m (/ (/ y z_m) -0.5)) (* 0.5 y))))
    x_m = fabs(x);
    z_m = fabs(z);
    double code(double x_m, double y, double z_m) {
    	double tmp;
    	if (y <= 4e-53) {
    		tmp = (x_m / y) * (0.5 * x_m);
    	} else if (y <= 0.00018) {
    		tmp = z_m / ((y / z_m) / -0.5);
    	} else {
    		tmp = 0.5 * y;
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    z_m = abs(z)
    real(8) function code(x_m, y, z_m)
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z_m
        real(8) :: tmp
        if (y <= 4d-53) then
            tmp = (x_m / y) * (0.5d0 * x_m)
        else if (y <= 0.00018d0) then
            tmp = z_m / ((y / z_m) / (-0.5d0))
        else
            tmp = 0.5d0 * y
        end if
        code = tmp
    end function
    
    x_m = Math.abs(x);
    z_m = Math.abs(z);
    public static double code(double x_m, double y, double z_m) {
    	double tmp;
    	if (y <= 4e-53) {
    		tmp = (x_m / y) * (0.5 * x_m);
    	} else if (y <= 0.00018) {
    		tmp = z_m / ((y / z_m) / -0.5);
    	} else {
    		tmp = 0.5 * y;
    	}
    	return tmp;
    }
    
    x_m = math.fabs(x)
    z_m = math.fabs(z)
    def code(x_m, y, z_m):
    	tmp = 0
    	if y <= 4e-53:
    		tmp = (x_m / y) * (0.5 * x_m)
    	elif y <= 0.00018:
    		tmp = z_m / ((y / z_m) / -0.5)
    	else:
    		tmp = 0.5 * y
    	return tmp
    
    x_m = abs(x)
    z_m = abs(z)
    function code(x_m, y, z_m)
    	tmp = 0.0
    	if (y <= 4e-53)
    		tmp = Float64(Float64(x_m / y) * Float64(0.5 * x_m));
    	elseif (y <= 0.00018)
    		tmp = Float64(z_m / Float64(Float64(y / z_m) / -0.5));
    	else
    		tmp = Float64(0.5 * y);
    	end
    	return tmp
    end
    
    x_m = abs(x);
    z_m = abs(z);
    function tmp_2 = code(x_m, y, z_m)
    	tmp = 0.0;
    	if (y <= 4e-53)
    		tmp = (x_m / y) * (0.5 * x_m);
    	elseif (y <= 0.00018)
    		tmp = z_m / ((y / z_m) / -0.5);
    	else
    		tmp = 0.5 * y;
    	end
    	tmp_2 = tmp;
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    z_m = N[Abs[z], $MachinePrecision]
    code[x$95$m_, y_, z$95$m_] := If[LessEqual[y, 4e-53], N[(N[(x$95$m / y), $MachinePrecision] * N[(0.5 * x$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.00018], N[(z$95$m / N[(N[(y / z$95$m), $MachinePrecision] / -0.5), $MachinePrecision]), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]]
    
    \begin{array}{l}
    x_m = \left|x\right|
    \\
    z_m = \left|z\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 4 \cdot 10^{-53}:\\
    \;\;\;\;\frac{x\_m}{y} \cdot \left(0.5 \cdot x\_m\right)\\
    
    \mathbf{elif}\;y \leq 0.00018:\\
    \;\;\;\;\frac{z\_m}{\frac{\frac{y}{z\_m}}{-0.5}}\\
    
    \mathbf{else}:\\
    \;\;\;\;0.5 \cdot y\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y < 4.00000000000000012e-53

      1. Initial program 76.6%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(\color{blue}{z} \cdot z\right)\right)\right)\right)\right) \]
        13. *-lowering-*.f6476.6%

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}} \]
      5. Taylor expanded in x around inf

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

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

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

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{y}{x \cdot x}}} \]
      8. Step-by-step derivation
        1. metadata-evalN/A

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

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

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

          \[\leadsto \frac{x}{\frac{y}{x}} \cdot \frac{1}{2} \]
        5. associate-/r/N/A

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

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

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

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

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

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

      if 4.00000000000000012e-53 < y < 1.80000000000000011e-4

      1. Initial program 92.2%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in z around inf

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

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

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

          \[\leadsto \frac{\frac{1}{2} \cdot \left(-1 \cdot {z}^{2}\right)}{y} \]
        4. mul-1-negN/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)}{y} \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)\right), \color{blue}{y}\right) \]
        6. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \frac{z \cdot -0.5}{y}} \]
      8. Step-by-step derivation
        1. clear-numN/A

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(z, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, z\right), \frac{-1}{2}\right)\right) \]
      9. Applied egg-rr46.7%

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

      if 1.80000000000000011e-4 < y

      1. Initial program 49.3%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in y around inf

        \[\leadsto \color{blue}{\frac{1}{2} \cdot y} \]
      4. Step-by-step derivation
        1. *-lowering-*.f6456.4%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{y}\right) \]
      5. Simplified56.4%

        \[\leadsto \color{blue}{0.5 \cdot y} \]
    3. Recombined 3 regimes into one program.
    4. Final simplification48.5%

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

    Alternative 4: 43.4% accurate, 0.9× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;y \leq 4.2 \cdot 10^{-53}:\\ \;\;\;\;\frac{x\_m}{y} \cdot \left(0.5 \cdot x\_m\right)\\ \mathbf{elif}\;y \leq 0.00023:\\ \;\;\;\;z\_m \cdot \frac{z\_m \cdot -0.5}{y}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    z_m = (fabs.f64 z)
    (FPCore (x_m y z_m)
     :precision binary64
     (if (<= y 4.2e-53)
       (* (/ x_m y) (* 0.5 x_m))
       (if (<= y 0.00023) (* z_m (/ (* z_m -0.5) y)) (* 0.5 y))))
    x_m = fabs(x);
    z_m = fabs(z);
    double code(double x_m, double y, double z_m) {
    	double tmp;
    	if (y <= 4.2e-53) {
    		tmp = (x_m / y) * (0.5 * x_m);
    	} else if (y <= 0.00023) {
    		tmp = z_m * ((z_m * -0.5) / y);
    	} else {
    		tmp = 0.5 * y;
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    z_m = abs(z)
    real(8) function code(x_m, y, z_m)
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z_m
        real(8) :: tmp
        if (y <= 4.2d-53) then
            tmp = (x_m / y) * (0.5d0 * x_m)
        else if (y <= 0.00023d0) then
            tmp = z_m * ((z_m * (-0.5d0)) / y)
        else
            tmp = 0.5d0 * y
        end if
        code = tmp
    end function
    
    x_m = Math.abs(x);
    z_m = Math.abs(z);
    public static double code(double x_m, double y, double z_m) {
    	double tmp;
    	if (y <= 4.2e-53) {
    		tmp = (x_m / y) * (0.5 * x_m);
    	} else if (y <= 0.00023) {
    		tmp = z_m * ((z_m * -0.5) / y);
    	} else {
    		tmp = 0.5 * y;
    	}
    	return tmp;
    }
    
    x_m = math.fabs(x)
    z_m = math.fabs(z)
    def code(x_m, y, z_m):
    	tmp = 0
    	if y <= 4.2e-53:
    		tmp = (x_m / y) * (0.5 * x_m)
    	elif y <= 0.00023:
    		tmp = z_m * ((z_m * -0.5) / y)
    	else:
    		tmp = 0.5 * y
    	return tmp
    
    x_m = abs(x)
    z_m = abs(z)
    function code(x_m, y, z_m)
    	tmp = 0.0
    	if (y <= 4.2e-53)
    		tmp = Float64(Float64(x_m / y) * Float64(0.5 * x_m));
    	elseif (y <= 0.00023)
    		tmp = Float64(z_m * Float64(Float64(z_m * -0.5) / y));
    	else
    		tmp = Float64(0.5 * y);
    	end
    	return tmp
    end
    
    x_m = abs(x);
    z_m = abs(z);
    function tmp_2 = code(x_m, y, z_m)
    	tmp = 0.0;
    	if (y <= 4.2e-53)
    		tmp = (x_m / y) * (0.5 * x_m);
    	elseif (y <= 0.00023)
    		tmp = z_m * ((z_m * -0.5) / y);
    	else
    		tmp = 0.5 * y;
    	end
    	tmp_2 = tmp;
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    z_m = N[Abs[z], $MachinePrecision]
    code[x$95$m_, y_, z$95$m_] := If[LessEqual[y, 4.2e-53], N[(N[(x$95$m / y), $MachinePrecision] * N[(0.5 * x$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.00023], N[(z$95$m * N[(N[(z$95$m * -0.5), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]]
    
    \begin{array}{l}
    x_m = \left|x\right|
    \\
    z_m = \left|z\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 4.2 \cdot 10^{-53}:\\
    \;\;\;\;\frac{x\_m}{y} \cdot \left(0.5 \cdot x\_m\right)\\
    
    \mathbf{elif}\;y \leq 0.00023:\\
    \;\;\;\;z\_m \cdot \frac{z\_m \cdot -0.5}{y}\\
    
    \mathbf{else}:\\
    \;\;\;\;0.5 \cdot y\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y < 4.19999999999999955e-53

      1. Initial program 76.6%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(\color{blue}{z} \cdot z\right)\right)\right)\right)\right) \]
        13. *-lowering-*.f6476.6%

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}} \]
      5. Taylor expanded in x around inf

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

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

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

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{y}{x \cdot x}}} \]
      8. Step-by-step derivation
        1. metadata-evalN/A

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

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

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

          \[\leadsto \frac{x}{\frac{y}{x}} \cdot \frac{1}{2} \]
        5. associate-/r/N/A

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

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

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

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

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

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

      if 4.19999999999999955e-53 < y < 2.3000000000000001e-4

      1. Initial program 92.2%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in z around inf

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

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

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

          \[\leadsto \frac{\frac{1}{2} \cdot \left(-1 \cdot {z}^{2}\right)}{y} \]
        4. mul-1-negN/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)}{y} \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)\right), \color{blue}{y}\right) \]
        6. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 2.3000000000000001e-4 < y

      1. Initial program 49.3%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in y around inf

        \[\leadsto \color{blue}{\frac{1}{2} \cdot y} \]
      4. Step-by-step derivation
        1. *-lowering-*.f6456.4%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{y}\right) \]
      5. Simplified56.4%

        \[\leadsto \color{blue}{0.5 \cdot y} \]
    3. Recombined 3 regimes into one program.
    4. Final simplification48.5%

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

    Alternative 5: 43.4% accurate, 0.9× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;y \leq 3.8 \cdot 10^{-53}:\\ \;\;\;\;x\_m \cdot \frac{0.5}{\frac{y}{x\_m}}\\ \mathbf{elif}\;y \leq 0.00058:\\ \;\;\;\;z\_m \cdot \frac{z\_m \cdot -0.5}{y}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    z_m = (fabs.f64 z)
    (FPCore (x_m y z_m)
     :precision binary64
     (if (<= y 3.8e-53)
       (* x_m (/ 0.5 (/ y x_m)))
       (if (<= y 0.00058) (* z_m (/ (* z_m -0.5) y)) (* 0.5 y))))
    x_m = fabs(x);
    z_m = fabs(z);
    double code(double x_m, double y, double z_m) {
    	double tmp;
    	if (y <= 3.8e-53) {
    		tmp = x_m * (0.5 / (y / x_m));
    	} else if (y <= 0.00058) {
    		tmp = z_m * ((z_m * -0.5) / y);
    	} else {
    		tmp = 0.5 * y;
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    z_m = abs(z)
    real(8) function code(x_m, y, z_m)
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z_m
        real(8) :: tmp
        if (y <= 3.8d-53) then
            tmp = x_m * (0.5d0 / (y / x_m))
        else if (y <= 0.00058d0) then
            tmp = z_m * ((z_m * (-0.5d0)) / y)
        else
            tmp = 0.5d0 * y
        end if
        code = tmp
    end function
    
    x_m = Math.abs(x);
    z_m = Math.abs(z);
    public static double code(double x_m, double y, double z_m) {
    	double tmp;
    	if (y <= 3.8e-53) {
    		tmp = x_m * (0.5 / (y / x_m));
    	} else if (y <= 0.00058) {
    		tmp = z_m * ((z_m * -0.5) / y);
    	} else {
    		tmp = 0.5 * y;
    	}
    	return tmp;
    }
    
    x_m = math.fabs(x)
    z_m = math.fabs(z)
    def code(x_m, y, z_m):
    	tmp = 0
    	if y <= 3.8e-53:
    		tmp = x_m * (0.5 / (y / x_m))
    	elif y <= 0.00058:
    		tmp = z_m * ((z_m * -0.5) / y)
    	else:
    		tmp = 0.5 * y
    	return tmp
    
    x_m = abs(x)
    z_m = abs(z)
    function code(x_m, y, z_m)
    	tmp = 0.0
    	if (y <= 3.8e-53)
    		tmp = Float64(x_m * Float64(0.5 / Float64(y / x_m)));
    	elseif (y <= 0.00058)
    		tmp = Float64(z_m * Float64(Float64(z_m * -0.5) / y));
    	else
    		tmp = Float64(0.5 * y);
    	end
    	return tmp
    end
    
    x_m = abs(x);
    z_m = abs(z);
    function tmp_2 = code(x_m, y, z_m)
    	tmp = 0.0;
    	if (y <= 3.8e-53)
    		tmp = x_m * (0.5 / (y / x_m));
    	elseif (y <= 0.00058)
    		tmp = z_m * ((z_m * -0.5) / y);
    	else
    		tmp = 0.5 * y;
    	end
    	tmp_2 = tmp;
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    z_m = N[Abs[z], $MachinePrecision]
    code[x$95$m_, y_, z$95$m_] := If[LessEqual[y, 3.8e-53], N[(x$95$m * N[(0.5 / N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.00058], N[(z$95$m * N[(N[(z$95$m * -0.5), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]]
    
    \begin{array}{l}
    x_m = \left|x\right|
    \\
    z_m = \left|z\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 3.8 \cdot 10^{-53}:\\
    \;\;\;\;x\_m \cdot \frac{0.5}{\frac{y}{x\_m}}\\
    
    \mathbf{elif}\;y \leq 0.00058:\\
    \;\;\;\;z\_m \cdot \frac{z\_m \cdot -0.5}{y}\\
    
    \mathbf{else}:\\
    \;\;\;\;0.5 \cdot y\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y < 3.7999999999999998e-53

      1. Initial program 76.6%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(\color{blue}{z} \cdot z\right)\right)\right)\right)\right) \]
        13. *-lowering-*.f6476.6%

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}} \]
      5. Taylor expanded in x around inf

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

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

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

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

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

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

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

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

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

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

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

      if 3.7999999999999998e-53 < y < 5.8e-4

      1. Initial program 92.2%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in z around inf

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

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

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

          \[\leadsto \frac{\frac{1}{2} \cdot \left(-1 \cdot {z}^{2}\right)}{y} \]
        4. mul-1-negN/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)}{y} \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)\right), \color{blue}{y}\right) \]
        6. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 5.8e-4 < y

      1. Initial program 49.3%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in y around inf

        \[\leadsto \color{blue}{\frac{1}{2} \cdot y} \]
      4. Step-by-step derivation
        1. *-lowering-*.f6456.4%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{y}\right) \]
      5. Simplified56.4%

        \[\leadsto \color{blue}{0.5 \cdot y} \]
    3. Recombined 3 regimes into one program.
    4. Final simplification48.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.8 \cdot 10^{-53}:\\ \;\;\;\;x \cdot \frac{0.5}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq 0.00058:\\ \;\;\;\;z \cdot \frac{z \cdot -0.5}{y}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]
    5. Add Preprocessing

    Alternative 6: 42.0% accurate, 0.9× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;y \leq 10^{-53}:\\ \;\;\;\;\left(x\_m \cdot x\_m\right) \cdot \frac{0.5}{y}\\ \mathbf{elif}\;y \leq 0.000125:\\ \;\;\;\;z\_m \cdot \frac{z\_m \cdot -0.5}{y}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    z_m = (fabs.f64 z)
    (FPCore (x_m y z_m)
     :precision binary64
     (if (<= y 1e-53)
       (* (* x_m x_m) (/ 0.5 y))
       (if (<= y 0.000125) (* z_m (/ (* z_m -0.5) y)) (* 0.5 y))))
    x_m = fabs(x);
    z_m = fabs(z);
    double code(double x_m, double y, double z_m) {
    	double tmp;
    	if (y <= 1e-53) {
    		tmp = (x_m * x_m) * (0.5 / y);
    	} else if (y <= 0.000125) {
    		tmp = z_m * ((z_m * -0.5) / y);
    	} else {
    		tmp = 0.5 * y;
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    z_m = abs(z)
    real(8) function code(x_m, y, z_m)
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z_m
        real(8) :: tmp
        if (y <= 1d-53) then
            tmp = (x_m * x_m) * (0.5d0 / y)
        else if (y <= 0.000125d0) then
            tmp = z_m * ((z_m * (-0.5d0)) / y)
        else
            tmp = 0.5d0 * y
        end if
        code = tmp
    end function
    
    x_m = Math.abs(x);
    z_m = Math.abs(z);
    public static double code(double x_m, double y, double z_m) {
    	double tmp;
    	if (y <= 1e-53) {
    		tmp = (x_m * x_m) * (0.5 / y);
    	} else if (y <= 0.000125) {
    		tmp = z_m * ((z_m * -0.5) / y);
    	} else {
    		tmp = 0.5 * y;
    	}
    	return tmp;
    }
    
    x_m = math.fabs(x)
    z_m = math.fabs(z)
    def code(x_m, y, z_m):
    	tmp = 0
    	if y <= 1e-53:
    		tmp = (x_m * x_m) * (0.5 / y)
    	elif y <= 0.000125:
    		tmp = z_m * ((z_m * -0.5) / y)
    	else:
    		tmp = 0.5 * y
    	return tmp
    
    x_m = abs(x)
    z_m = abs(z)
    function code(x_m, y, z_m)
    	tmp = 0.0
    	if (y <= 1e-53)
    		tmp = Float64(Float64(x_m * x_m) * Float64(0.5 / y));
    	elseif (y <= 0.000125)
    		tmp = Float64(z_m * Float64(Float64(z_m * -0.5) / y));
    	else
    		tmp = Float64(0.5 * y);
    	end
    	return tmp
    end
    
    x_m = abs(x);
    z_m = abs(z);
    function tmp_2 = code(x_m, y, z_m)
    	tmp = 0.0;
    	if (y <= 1e-53)
    		tmp = (x_m * x_m) * (0.5 / y);
    	elseif (y <= 0.000125)
    		tmp = z_m * ((z_m * -0.5) / y);
    	else
    		tmp = 0.5 * y;
    	end
    	tmp_2 = tmp;
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    z_m = N[Abs[z], $MachinePrecision]
    code[x$95$m_, y_, z$95$m_] := If[LessEqual[y, 1e-53], N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(0.5 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.000125], N[(z$95$m * N[(N[(z$95$m * -0.5), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]]
    
    \begin{array}{l}
    x_m = \left|x\right|
    \\
    z_m = \left|z\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 10^{-53}:\\
    \;\;\;\;\left(x\_m \cdot x\_m\right) \cdot \frac{0.5}{y}\\
    
    \mathbf{elif}\;y \leq 0.000125:\\
    \;\;\;\;z\_m \cdot \frac{z\_m \cdot -0.5}{y}\\
    
    \mathbf{else}:\\
    \;\;\;\;0.5 \cdot y\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y < 1.00000000000000003e-53

      1. Initial program 76.6%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(\color{blue}{z} \cdot z\right)\right)\right)\right)\right) \]
        13. *-lowering-*.f6476.6%

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}} \]
      5. Taylor expanded in y around 0

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

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

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

          \[\leadsto \left({x}^{2} - {z}^{2}\right) \cdot \color{blue}{\frac{\frac{1}{2}}{y}} \]
        4. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(z, z\right)\right), \mathsf{/.f64}\left(\frac{1}{2}, \color{blue}{y}\right)\right) \]
      7. Simplified62.8%

        \[\leadsto \color{blue}{\left(x \cdot x - z \cdot z\right) \cdot \frac{0.5}{y}} \]
      8. Taylor expanded in x around inf

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

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

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

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

      if 1.00000000000000003e-53 < y < 1.25e-4

      1. Initial program 92.2%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in z around inf

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

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

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

          \[\leadsto \frac{\frac{1}{2} \cdot \left(-1 \cdot {z}^{2}\right)}{y} \]
        4. mul-1-negN/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)}{y} \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)\right), \color{blue}{y}\right) \]
        6. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 1.25e-4 < y

      1. Initial program 49.3%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in y around inf

        \[\leadsto \color{blue}{\frac{1}{2} \cdot y} \]
      4. Step-by-step derivation
        1. *-lowering-*.f6456.4%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{y}\right) \]
      5. Simplified56.4%

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

    Alternative 7: 81.8% accurate, 0.9× speedup?

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

      1. Initial program 75.6%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{{y}^{2} - {z}^{2}}{y}} \]
      4. Step-by-step derivation
        1. div-subN/A

          \[\leadsto \frac{1}{2} \cdot \left(\frac{{y}^{2}}{y} - \color{blue}{\frac{{z}^{2}}{y}}\right) \]
        2. sub-negN/A

          \[\leadsto \frac{1}{2} \cdot \left(\frac{{y}^{2}}{y} + \color{blue}{\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right)}\right) \]
        3. +-commutativeN/A

          \[\leadsto \frac{1}{2} \cdot \left(\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right) + \color{blue}{\frac{{y}^{2}}{y}}\right) \]
        4. unpow2N/A

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

          \[\leadsto \frac{1}{2} \cdot \left(\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right) + y \cdot \color{blue}{\frac{y}{y}}\right) \]
        6. *-inversesN/A

          \[\leadsto \frac{1}{2} \cdot \left(\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right) + y \cdot 1\right) \]
        7. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \left(\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right) + y\right) \]
        8. +-commutativeN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(\frac{{z}^{2}}{y}\right)\right)}\right) \]
        9. sub-negN/A

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

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

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

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

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

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

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

      if 9.9999999999999996e-70 < (*.f64 x x)

      1. Initial program 67.2%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in z around 0

        \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{{x}^{2} + {y}^{2}}{y}} \]
      4. Step-by-step derivation
        1. *-lft-identityN/A

          \[\leadsto \frac{1}{2} \cdot \frac{1 \cdot {x}^{2} + {y}^{2}}{y} \]
        2. *-inversesN/A

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

          \[\leadsto \frac{1}{2} \cdot \frac{\frac{{y}^{2} \cdot {x}^{2}}{{y}^{2}} + {y}^{2}}{y} \]
        4. associate-*r/N/A

          \[\leadsto \frac{1}{2} \cdot \frac{{y}^{2} \cdot \frac{{x}^{2}}{{y}^{2}} + {y}^{2}}{y} \]
        5. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \frac{{y}^{2} \cdot \frac{{x}^{2}}{{y}^{2}} + {y}^{2} \cdot 1}{y} \]
        6. distribute-lft-inN/A

          \[\leadsto \frac{1}{2} \cdot \frac{{y}^{2} \cdot \left(\frac{{x}^{2}}{{y}^{2}} + 1\right)}{y} \]
        7. +-commutativeN/A

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

          \[\leadsto \frac{1}{2} \cdot \left(\frac{{y}^{2}}{y} \cdot \color{blue}{\left(1 + \frac{{x}^{2}}{{y}^{2}}\right)}\right) \]
        9. unpow2N/A

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

          \[\leadsto \frac{1}{2} \cdot \left(\left(y \cdot \frac{y}{y}\right) \cdot \left(\color{blue}{1} + \frac{{x}^{2}}{{y}^{2}}\right)\right) \]
        11. *-inversesN/A

          \[\leadsto \frac{1}{2} \cdot \left(\left(y \cdot 1\right) \cdot \left(1 + \frac{{x}^{2}}{{y}^{2}}\right)\right) \]
        12. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \left(y \cdot \left(\color{blue}{1} + \frac{{x}^{2}}{{y}^{2}}\right)\right) \]
        13. distribute-lft-inN/A

          \[\leadsto \frac{1}{2} \cdot \left(y \cdot 1 + \color{blue}{y \cdot \frac{{x}^{2}}{{y}^{2}}}\right) \]
        14. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \color{blue}{y} \cdot \frac{{x}^{2}}{{y}^{2}}\right) \]
        15. *-commutativeN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{{y}^{2}} \cdot \color{blue}{y}\right) \]
        16. associate-/r/N/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{\color{blue}{\frac{{y}^{2}}{y}}}\right) \]
        17. unpow2N/A

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

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{y \cdot \color{blue}{\frac{y}{y}}}\right) \]
        19. *-inversesN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{y \cdot 1}\right) \]
        20. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{y}\right) \]
      5. Simplified76.8%

        \[\leadsto \color{blue}{0.5 \cdot \left(y + \frac{x \cdot x}{y}\right)} \]
      6. Step-by-step derivation
        1. associate-/l*N/A

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

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

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(y, \mathsf{*.f64}\left(\left(\frac{x}{y}\right), \color{blue}{x}\right)\right)\right) \]
        4. /-lowering-/.f6484.9%

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

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{x}{y} \cdot x}\right) \]
    3. Recombined 2 regimes into one program.
    4. Final simplification85.4%

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

    Alternative 8: 80.1% accurate, 1.1× speedup?

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

      1. Initial program 73.5%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in z around 0

        \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{{x}^{2} + {y}^{2}}{y}} \]
      4. Step-by-step derivation
        1. *-lft-identityN/A

          \[\leadsto \frac{1}{2} \cdot \frac{1 \cdot {x}^{2} + {y}^{2}}{y} \]
        2. *-inversesN/A

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

          \[\leadsto \frac{1}{2} \cdot \frac{\frac{{y}^{2} \cdot {x}^{2}}{{y}^{2}} + {y}^{2}}{y} \]
        4. associate-*r/N/A

          \[\leadsto \frac{1}{2} \cdot \frac{{y}^{2} \cdot \frac{{x}^{2}}{{y}^{2}} + {y}^{2}}{y} \]
        5. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \frac{{y}^{2} \cdot \frac{{x}^{2}}{{y}^{2}} + {y}^{2} \cdot 1}{y} \]
        6. distribute-lft-inN/A

          \[\leadsto \frac{1}{2} \cdot \frac{{y}^{2} \cdot \left(\frac{{x}^{2}}{{y}^{2}} + 1\right)}{y} \]
        7. +-commutativeN/A

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

          \[\leadsto \frac{1}{2} \cdot \left(\frac{{y}^{2}}{y} \cdot \color{blue}{\left(1 + \frac{{x}^{2}}{{y}^{2}}\right)}\right) \]
        9. unpow2N/A

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

          \[\leadsto \frac{1}{2} \cdot \left(\left(y \cdot \frac{y}{y}\right) \cdot \left(\color{blue}{1} + \frac{{x}^{2}}{{y}^{2}}\right)\right) \]
        11. *-inversesN/A

          \[\leadsto \frac{1}{2} \cdot \left(\left(y \cdot 1\right) \cdot \left(1 + \frac{{x}^{2}}{{y}^{2}}\right)\right) \]
        12. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \left(y \cdot \left(\color{blue}{1} + \frac{{x}^{2}}{{y}^{2}}\right)\right) \]
        13. distribute-lft-inN/A

          \[\leadsto \frac{1}{2} \cdot \left(y \cdot 1 + \color{blue}{y \cdot \frac{{x}^{2}}{{y}^{2}}}\right) \]
        14. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \color{blue}{y} \cdot \frac{{x}^{2}}{{y}^{2}}\right) \]
        15. *-commutativeN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{{y}^{2}} \cdot \color{blue}{y}\right) \]
        16. associate-/r/N/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{\color{blue}{\frac{{y}^{2}}{y}}}\right) \]
        17. unpow2N/A

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

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{y \cdot \color{blue}{\frac{y}{y}}}\right) \]
        19. *-inversesN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{y \cdot 1}\right) \]
        20. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{y}\right) \]
      5. Simplified74.7%

        \[\leadsto \color{blue}{0.5 \cdot \left(y + \frac{x \cdot x}{y}\right)} \]
      6. Step-by-step derivation
        1. associate-/l*N/A

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

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

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(y, \mathsf{*.f64}\left(\left(\frac{x}{y}\right), \color{blue}{x}\right)\right)\right) \]
        4. /-lowering-/.f6480.3%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(y, \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), x\right)\right)\right) \]
      7. Applied egg-rr80.3%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{x}{y} \cdot x}\right) \]
      8. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

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

      if 1.6000000000000001e162 < z

      1. Initial program 49.7%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in z around inf

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

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

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

          \[\leadsto \frac{\frac{1}{2} \cdot \left(-1 \cdot {z}^{2}\right)}{y} \]
        4. mul-1-negN/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)}{y} \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)\right), \color{blue}{y}\right) \]
        6. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \frac{z \cdot -0.5}{y}} \]
      8. Step-by-step derivation
        1. clear-numN/A

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(z, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, z\right), \frac{-1}{2}\right)\right) \]
      9. Applied egg-rr89.7%

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

    Alternative 9: 80.1% accurate, 1.1× speedup?

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

      1. Initial program 73.5%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in z around 0

        \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{{x}^{2} + {y}^{2}}{y}} \]
      4. Step-by-step derivation
        1. *-lft-identityN/A

          \[\leadsto \frac{1}{2} \cdot \frac{1 \cdot {x}^{2} + {y}^{2}}{y} \]
        2. *-inversesN/A

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

          \[\leadsto \frac{1}{2} \cdot \frac{\frac{{y}^{2} \cdot {x}^{2}}{{y}^{2}} + {y}^{2}}{y} \]
        4. associate-*r/N/A

          \[\leadsto \frac{1}{2} \cdot \frac{{y}^{2} \cdot \frac{{x}^{2}}{{y}^{2}} + {y}^{2}}{y} \]
        5. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \frac{{y}^{2} \cdot \frac{{x}^{2}}{{y}^{2}} + {y}^{2} \cdot 1}{y} \]
        6. distribute-lft-inN/A

          \[\leadsto \frac{1}{2} \cdot \frac{{y}^{2} \cdot \left(\frac{{x}^{2}}{{y}^{2}} + 1\right)}{y} \]
        7. +-commutativeN/A

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

          \[\leadsto \frac{1}{2} \cdot \left(\frac{{y}^{2}}{y} \cdot \color{blue}{\left(1 + \frac{{x}^{2}}{{y}^{2}}\right)}\right) \]
        9. unpow2N/A

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

          \[\leadsto \frac{1}{2} \cdot \left(\left(y \cdot \frac{y}{y}\right) \cdot \left(\color{blue}{1} + \frac{{x}^{2}}{{y}^{2}}\right)\right) \]
        11. *-inversesN/A

          \[\leadsto \frac{1}{2} \cdot \left(\left(y \cdot 1\right) \cdot \left(1 + \frac{{x}^{2}}{{y}^{2}}\right)\right) \]
        12. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \left(y \cdot \left(\color{blue}{1} + \frac{{x}^{2}}{{y}^{2}}\right)\right) \]
        13. distribute-lft-inN/A

          \[\leadsto \frac{1}{2} \cdot \left(y \cdot 1 + \color{blue}{y \cdot \frac{{x}^{2}}{{y}^{2}}}\right) \]
        14. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \color{blue}{y} \cdot \frac{{x}^{2}}{{y}^{2}}\right) \]
        15. *-commutativeN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{{y}^{2}} \cdot \color{blue}{y}\right) \]
        16. associate-/r/N/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{\color{blue}{\frac{{y}^{2}}{y}}}\right) \]
        17. unpow2N/A

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

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{y \cdot \color{blue}{\frac{y}{y}}}\right) \]
        19. *-inversesN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{y \cdot 1}\right) \]
        20. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot \left(y + \frac{{x}^{2}}{y}\right) \]
      5. Simplified74.7%

        \[\leadsto \color{blue}{0.5 \cdot \left(y + \frac{x \cdot x}{y}\right)} \]
      6. Step-by-step derivation
        1. associate-/l*N/A

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

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

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(y, \mathsf{*.f64}\left(\left(\frac{x}{y}\right), \color{blue}{x}\right)\right)\right) \]
        4. /-lowering-/.f6480.3%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(y, \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), x\right)\right)\right) \]
      7. Applied egg-rr80.3%

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

      if 3.50000000000000018e162 < z

      1. Initial program 49.7%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in z around inf

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

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

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

          \[\leadsto \frac{\frac{1}{2} \cdot \left(-1 \cdot {z}^{2}\right)}{y} \]
        4. mul-1-negN/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)}{y} \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)\right), \color{blue}{y}\right) \]
        6. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \frac{z \cdot -0.5}{y}} \]
      8. Step-by-step derivation
        1. clear-numN/A

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(z, \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, z\right), \frac{-1}{2}\right)\right) \]
      9. Applied egg-rr89.7%

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

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

    Alternative 10: 51.9% accurate, 1.2× speedup?

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

      1. Initial program 73.3%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in y around inf

        \[\leadsto \color{blue}{\frac{1}{2} \cdot y} \]
      4. Step-by-step derivation
        1. *-lowering-*.f6439.5%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{y}\right) \]
      5. Simplified39.5%

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

      if 2.4e125 < z

      1. Initial program 54.4%

        \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      2. Add Preprocessing
      3. Taylor expanded in z around inf

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

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

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

          \[\leadsto \frac{\frac{1}{2} \cdot \left(-1 \cdot {z}^{2}\right)}{y} \]
        4. mul-1-negN/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)}{y} \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \left(\mathsf{neg}\left({z}^{2}\right)\right)\right), \color{blue}{y}\right) \]
        6. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 11: 34.8% accurate, 5.0× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ z_m = \left|z\right| \\ 0.5 \cdot y \end{array} \]
    x_m = (fabs.f64 x)
    z_m = (fabs.f64 z)
    (FPCore (x_m y z_m) :precision binary64 (* 0.5 y))
    x_m = fabs(x);
    z_m = fabs(z);
    double code(double x_m, double y, double z_m) {
    	return 0.5 * y;
    }
    
    x_m = abs(x)
    z_m = abs(z)
    real(8) function code(x_m, y, z_m)
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z_m
        code = 0.5d0 * y
    end function
    
    x_m = Math.abs(x);
    z_m = Math.abs(z);
    public static double code(double x_m, double y, double z_m) {
    	return 0.5 * y;
    }
    
    x_m = math.fabs(x)
    z_m = math.fabs(z)
    def code(x_m, y, z_m):
    	return 0.5 * y
    
    x_m = abs(x)
    z_m = abs(z)
    function code(x_m, y, z_m)
    	return Float64(0.5 * y)
    end
    
    x_m = abs(x);
    z_m = abs(z);
    function tmp = code(x_m, y, z_m)
    	tmp = 0.5 * y;
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    z_m = N[Abs[z], $MachinePrecision]
    code[x$95$m_, y_, z$95$m_] := N[(0.5 * y), $MachinePrecision]
    
    \begin{array}{l}
    x_m = \left|x\right|
    \\
    z_m = \left|z\right|
    
    \\
    0.5 \cdot y
    \end{array}
    
    Derivation
    1. Initial program 70.8%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot y} \]
    4. Step-by-step derivation
      1. *-lowering-*.f6435.2%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{y}\right) \]
    5. Simplified35.2%

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

    Developer Target 1: 99.8% 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 2024192 
    (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)))