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

Percentage Accurate: 69.2% → 96.0%
Time: 17.4s
Alternatives: 10
Speedup: 0.9×

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 10 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 69.2% 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: 96.0% accurate, 0.0× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ \begin{array}{l} t_0 := \frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-47}:\\ \;\;\;\;\frac{y\_m + z}{\frac{y\_m \cdot 2}{y\_m - z}}\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\mathsf{hypot}\left(\mathsf{hypot}\left(x, y\_m\right), z\right) \cdot \left(0.5 \cdot \frac{\mathsf{hypot}\left(y\_m, x\right)}{y\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m - z}{y\_m} \cdot \frac{y\_m + z}{2}\\ \end{array} \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
 :precision binary64
 (let* ((t_0 (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0))))
   (*
    y_s
    (if (<= t_0 -4e-47)
      (/ (+ y_m z) (/ (* y_m 2.0) (- y_m z)))
      (if (<= t_0 INFINITY)
        (* (hypot (hypot x y_m) z) (* 0.5 (/ (hypot y_m x) y_m)))
        (* (/ (- y_m z) y_m) (/ (+ y_m z) 2.0)))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
	double tmp;
	if (t_0 <= -4e-47) {
		tmp = (y_m + z) / ((y_m * 2.0) / (y_m - z));
	} else if (t_0 <= ((double) INFINITY)) {
		tmp = hypot(hypot(x, y_m), z) * (0.5 * (hypot(y_m, x) / y_m));
	} else {
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0);
	}
	return y_s * tmp;
}
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
	double tmp;
	if (t_0 <= -4e-47) {
		tmp = (y_m + z) / ((y_m * 2.0) / (y_m - z));
	} else if (t_0 <= Double.POSITIVE_INFINITY) {
		tmp = Math.hypot(Math.hypot(x, y_m), z) * (0.5 * (Math.hypot(y_m, x) / y_m));
	} else {
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0);
	}
	return y_s * tmp;
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)
	tmp = 0
	if t_0 <= -4e-47:
		tmp = (y_m + z) / ((y_m * 2.0) / (y_m - z))
	elif t_0 <= math.inf:
		tmp = math.hypot(math.hypot(x, y_m), z) * (0.5 * (math.hypot(y_m, x) / y_m))
	else:
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0)
	return y_s * tmp
y_m = abs(y)
y_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	t_0 = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0))
	tmp = 0.0
	if (t_0 <= -4e-47)
		tmp = Float64(Float64(y_m + z) / Float64(Float64(y_m * 2.0) / Float64(y_m - z)));
	elseif (t_0 <= Inf)
		tmp = Float64(hypot(hypot(x, y_m), z) * Float64(0.5 * Float64(hypot(y_m, x) / y_m)));
	else
		tmp = Float64(Float64(Float64(y_m - z) / y_m) * Float64(Float64(y_m + z) / 2.0));
	end
	return Float64(y_s * tmp)
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
	tmp = 0.0;
	if (t_0 <= -4e-47)
		tmp = (y_m + z) / ((y_m * 2.0) / (y_m - z));
	elseif (t_0 <= Inf)
		tmp = hypot(hypot(x, y_m), z) * (0.5 * (hypot(y_m, x) / y_m));
	else
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0);
	end
	tmp_2 = y_s * tmp;
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, -4e-47], N[(N[(y$95$m + z), $MachinePrecision] / N[(N[(y$95$m * 2.0), $MachinePrecision] / N[(y$95$m - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[Sqrt[N[Sqrt[x ^ 2 + y$95$m ^ 2], $MachinePrecision] ^ 2 + z ^ 2], $MachinePrecision] * N[(0.5 * N[(N[Sqrt[y$95$m ^ 2 + x ^ 2], $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y$95$m - z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(y$95$m + z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)

\\
\begin{array}{l}
t_0 := \frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-47}:\\
\;\;\;\;\frac{y\_m + z}{\frac{y\_m \cdot 2}{y\_m - z}}\\

\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\mathsf{hypot}\left(\mathsf{hypot}\left(x, y\_m\right), z\right) \cdot \left(0.5 \cdot \frac{\mathsf{hypot}\left(y\_m, x\right)}{y\_m}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{y\_m - z}{y\_m} \cdot \frac{y\_m + z}{2}\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y 2)) < -3.9999999999999999e-47

    1. Initial program 80.7%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. associate--l+80.7%

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

        \[\leadsto \frac{\color{blue}{\left(y \cdot y - z \cdot z\right) + x \cdot x}}{y \cdot 2} \]
      3. sqr-neg80.7%

        \[\leadsto \frac{\left(y \cdot y - \color{blue}{\left(-z\right) \cdot \left(-z\right)}\right) + x \cdot x}{y \cdot 2} \]
      4. difference-of-squares80.7%

        \[\leadsto \frac{\color{blue}{\left(y + \left(-z\right)\right) \cdot \left(y - \left(-z\right)\right)} + x \cdot x}{y \cdot 2} \]
      5. fma-def80.7%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + \left(-z\right), y - \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      6. sub-neg80.7%

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{y - z}, y - \left(-z\right), x \cdot x\right)}{y \cdot 2} \]
      7. sub-neg80.7%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, \color{blue}{y + \left(-\left(-z\right)\right)}, x \cdot x\right)}{y \cdot 2} \]
      8. remove-double-neg80.7%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, y + \color{blue}{z}, x \cdot x\right)}{y \cdot 2} \]
    3. Simplified80.7%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y - z, y + z, x \cdot x\right)}{y \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 51.2%

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

        \[\leadsto \color{blue}{\frac{y + z}{\frac{y \cdot 2}{y - z}}} \]
      2. div-inv67.0%

        \[\leadsto \color{blue}{\left(y + z\right) \cdot \frac{1}{\frac{y \cdot 2}{y - z}}} \]
      3. *-commutative67.0%

        \[\leadsto \left(y + z\right) \cdot \frac{1}{\frac{\color{blue}{2 \cdot y}}{y - z}} \]
      4. *-un-lft-identity67.0%

        \[\leadsto \left(y + z\right) \cdot \frac{1}{\frac{2 \cdot y}{\color{blue}{1 \cdot \left(y - z\right)}}} \]
      5. times-frac67.0%

        \[\leadsto \left(y + z\right) \cdot \frac{1}{\color{blue}{\frac{2}{1} \cdot \frac{y}{y - z}}} \]
      6. metadata-eval67.0%

        \[\leadsto \left(y + z\right) \cdot \frac{1}{\color{blue}{2} \cdot \frac{y}{y - z}} \]
    7. Applied egg-rr67.0%

      \[\leadsto \color{blue}{\left(y + z\right) \cdot \frac{1}{2 \cdot \frac{y}{y - z}}} \]
    8. Step-by-step derivation
      1. associate-*r/67.0%

        \[\leadsto \color{blue}{\frac{\left(y + z\right) \cdot 1}{2 \cdot \frac{y}{y - z}}} \]
      2. *-rgt-identity67.0%

        \[\leadsto \frac{\color{blue}{y + z}}{2 \cdot \frac{y}{y - z}} \]
      3. associate-*r/67.0%

        \[\leadsto \frac{y + z}{\color{blue}{\frac{2 \cdot y}{y - z}}} \]
      4. *-commutative67.0%

        \[\leadsto \frac{y + z}{\frac{\color{blue}{y \cdot 2}}{y - z}} \]
    9. Simplified67.0%

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

    if -3.9999999999999999e-47 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y 2)) < +inf.0

    1. Initial program 74.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. expm1-log1p-u71.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\right)\right)} \]
      2. expm1-udef69.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\right)} - 1} \]
    4. Applied egg-rr69.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right) \cdot \frac{0.5}{y}\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def71.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right) \cdot \frac{0.5}{y}\right)\right)} \]
      2. expm1-log1p74.2%

        \[\leadsto \color{blue}{\left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right) \cdot \frac{0.5}{y}} \]
      3. *-commutative74.2%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)} \]
    6. Simplified74.2%

      \[\leadsto \color{blue}{\frac{0.5}{y} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)} \]
    7. Step-by-step derivation
      1. add-cube-cbrt73.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{0.5}{y} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)} \cdot \sqrt[3]{\frac{0.5}{y} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)}\right) \cdot \sqrt[3]{\frac{0.5}{y} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)}} \]
      2. pow373.6%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\frac{0.5}{y} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)}\right)}^{3}} \]
    8. Applied egg-rr73.6%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\frac{0.5}{y} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)}\right)}^{3}} \]
    9. Step-by-step derivation
      1. rem-cube-cbrt74.2%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)} \]
      2. *-commutative74.2%

        \[\leadsto \color{blue}{\left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right) \cdot \frac{0.5}{y}} \]
      3. add-sqr-sqrt41.5%

        \[\leadsto \color{blue}{\left(\sqrt{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}} \cdot \sqrt{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}\right)} \cdot \frac{0.5}{y} \]
      4. associate-*l*41.5%

        \[\leadsto \color{blue}{\sqrt{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}} \cdot \left(\sqrt{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}} \cdot \frac{0.5}{y}\right)} \]
    10. Applied egg-rr67.2%

      \[\leadsto \color{blue}{\mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right) \cdot \left(\mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right) \cdot \frac{0.5}{y}\right)} \]
    11. Taylor expanded in z around 0 41.7%

      \[\leadsto \mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right) \cdot \color{blue}{\left(0.5 \cdot \left(\frac{1}{y} \cdot \sqrt{{x}^{2} + {y}^{2}}\right)\right)} \]
    12. Step-by-step derivation
      1. associate-*l/41.7%

        \[\leadsto \mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right) \cdot \left(0.5 \cdot \color{blue}{\frac{1 \cdot \sqrt{{x}^{2} + {y}^{2}}}{y}}\right) \]
      2. *-lft-identity41.7%

        \[\leadsto \mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right) \cdot \left(0.5 \cdot \frac{\color{blue}{\sqrt{{x}^{2} + {y}^{2}}}}{y}\right) \]
      3. +-commutative41.7%

        \[\leadsto \mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right) \cdot \left(0.5 \cdot \frac{\sqrt{\color{blue}{{y}^{2} + {x}^{2}}}}{y}\right) \]
      4. unpow241.7%

        \[\leadsto \mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right) \cdot \left(0.5 \cdot \frac{\sqrt{\color{blue}{y \cdot y} + {x}^{2}}}{y}\right) \]
      5. unpow241.7%

        \[\leadsto \mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right) \cdot \left(0.5 \cdot \frac{\sqrt{y \cdot y + \color{blue}{x \cdot x}}}{y}\right) \]
      6. hypot-def67.3%

        \[\leadsto \mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right) \cdot \left(0.5 \cdot \frac{\color{blue}{\mathsf{hypot}\left(y, x\right)}}{y}\right) \]
    13. Simplified67.3%

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

    if +inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y 2))

    1. Initial program 0.0%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. associate--l+0.0%

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

        \[\leadsto \frac{\color{blue}{\left(y \cdot y - z \cdot z\right) + x \cdot x}}{y \cdot 2} \]
      3. sqr-neg0.0%

        \[\leadsto \frac{\left(y \cdot y - \color{blue}{\left(-z\right) \cdot \left(-z\right)}\right) + x \cdot x}{y \cdot 2} \]
      4. difference-of-squares18.2%

        \[\leadsto \frac{\color{blue}{\left(y + \left(-z\right)\right) \cdot \left(y - \left(-z\right)\right)} + x \cdot x}{y \cdot 2} \]
      5. fma-def45.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + \left(-z\right), y - \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      6. sub-neg45.8%

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{y - z}, y - \left(-z\right), x \cdot x\right)}{y \cdot 2} \]
      7. sub-neg45.8%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, \color{blue}{y + \left(-\left(-z\right)\right)}, x \cdot x\right)}{y \cdot 2} \]
      8. remove-double-neg45.8%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, y + \color{blue}{z}, x \cdot x\right)}{y \cdot 2} \]
    3. Simplified45.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y - z, y + z, x \cdot x\right)}{y \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 33.6%

      \[\leadsto \frac{\color{blue}{\left(y + z\right) \cdot \left(y - z\right)}}{y \cdot 2} \]
    6. Step-by-step derivation
      1. *-commutative33.6%

        \[\leadsto \frac{\color{blue}{\left(y - z\right) \cdot \left(y + z\right)}}{y \cdot 2} \]
      2. times-frac66.7%

        \[\leadsto \color{blue}{\frac{y - z}{y} \cdot \frac{y + z}{2}} \]
    7. Applied egg-rr66.7%

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

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

Alternative 2: 88.7% accurate, 0.1× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 3.3 \cdot 10^{+156}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, x, y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m - z}{y\_m} \cdot \frac{y\_m + z}{2}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= y_m 3.3e+156)
    (/ (- (fma x x (* y_m y_m)) (* z z)) (* y_m 2.0))
    (* (/ (- y_m z) y_m) (/ (+ y_m z) 2.0)))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 3.3e+156) {
		tmp = (fma(x, x, (y_m * y_m)) - (z * z)) / (y_m * 2.0);
	} else {
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0);
	}
	return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (y_m <= 3.3e+156)
		tmp = Float64(Float64(fma(x, x, Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0));
	else
		tmp = Float64(Float64(Float64(y_m - z) / y_m) * Float64(Float64(y_m + z) / 2.0));
	end
	return Float64(y_s * tmp)
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 3.3e+156], N[(N[(N[(x * x + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y$95$m - z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(y$95$m + z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 3.3 \cdot 10^{+156}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{y\_m - z}{y\_m} \cdot \frac{y\_m + z}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.2999999999999999e156

    1. Initial program 78.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. div-sub74.2%

        \[\leadsto \color{blue}{\frac{x \cdot x + y \cdot y}{y \cdot 2} - \frac{z \cdot z}{y \cdot 2}} \]
      2. sqr-neg74.2%

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

        \[\leadsto \color{blue}{\frac{\left(\left(-x\right) \cdot \left(-x\right) + y \cdot y\right) - z \cdot z}{y \cdot 2}} \]
      4. sqr-neg78.3%

        \[\leadsto \frac{\left(\color{blue}{x \cdot x} + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
      5. fma-def78.4%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y\right)} - z \cdot z}{y \cdot 2} \]
    3. Simplified78.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, x, y \cdot y\right) - z \cdot z}{y \cdot 2}} \]
    4. Add Preprocessing

    if 3.2999999999999999e156 < y

    1. Initial program 9.7%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. associate--l+9.7%

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

        \[\leadsto \frac{\color{blue}{\left(y \cdot y - z \cdot z\right) + x \cdot x}}{y \cdot 2} \]
      3. sqr-neg9.7%

        \[\leadsto \frac{\left(y \cdot y - \color{blue}{\left(-z\right) \cdot \left(-z\right)}\right) + x \cdot x}{y \cdot 2} \]
      4. difference-of-squares18.3%

        \[\leadsto \frac{\color{blue}{\left(y + \left(-z\right)\right) \cdot \left(y - \left(-z\right)\right)} + x \cdot x}{y \cdot 2} \]
      5. fma-def20.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + \left(-z\right), y - \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      6. sub-neg20.8%

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{y - z}, y - \left(-z\right), x \cdot x\right)}{y \cdot 2} \]
      7. sub-neg20.8%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, \color{blue}{y + \left(-\left(-z\right)\right)}, x \cdot x\right)}{y \cdot 2} \]
      8. remove-double-neg20.8%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, y + \color{blue}{z}, x \cdot x\right)}{y \cdot 2} \]
    3. Simplified20.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y - z, y + z, x \cdot x\right)}{y \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 18.3%

      \[\leadsto \frac{\color{blue}{\left(y + z\right) \cdot \left(y - z\right)}}{y \cdot 2} \]
    6. Step-by-step derivation
      1. *-commutative18.3%

        \[\leadsto \frac{\color{blue}{\left(y - z\right) \cdot \left(y + z\right)}}{y \cdot 2} \]
      2. times-frac86.1%

        \[\leadsto \color{blue}{\frac{y - z}{y} \cdot \frac{y + z}{2}} \]
    7. Applied egg-rr86.1%

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

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

Alternative 3: 90.8% accurate, 0.1× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 3.3 \cdot 10^{+156}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y\_m - z, y\_m + z, x \cdot x\right)}{y\_m \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m - z}{y\_m} \cdot \frac{y\_m + z}{2}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= y_m 3.3e+156)
    (/ (fma (- y_m z) (+ y_m z) (* x x)) (* y_m 2.0))
    (* (/ (- y_m z) y_m) (/ (+ y_m z) 2.0)))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 3.3e+156) {
		tmp = fma((y_m - z), (y_m + z), (x * x)) / (y_m * 2.0);
	} else {
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0);
	}
	return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (y_m <= 3.3e+156)
		tmp = Float64(fma(Float64(y_m - z), Float64(y_m + z), Float64(x * x)) / Float64(y_m * 2.0));
	else
		tmp = Float64(Float64(Float64(y_m - z) / y_m) * Float64(Float64(y_m + z) / 2.0));
	end
	return Float64(y_s * tmp)
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 3.3e+156], N[(N[(N[(y$95$m - z), $MachinePrecision] * N[(y$95$m + z), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y$95$m - z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(y$95$m + z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 3.3 \cdot 10^{+156}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y\_m - z, y\_m + z, x \cdot x\right)}{y\_m \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{y\_m - z}{y\_m} \cdot \frac{y\_m + z}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.2999999999999999e156

    1. Initial program 78.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. associate--l+78.3%

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

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

        \[\leadsto \frac{\left(y \cdot y - \color{blue}{\left(-z\right) \cdot \left(-z\right)}\right) + x \cdot x}{y \cdot 2} \]
      4. difference-of-squares79.5%

        \[\leadsto \frac{\color{blue}{\left(y + \left(-z\right)\right) \cdot \left(y - \left(-z\right)\right)} + x \cdot x}{y \cdot 2} \]
      5. fma-def83.3%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + \left(-z\right), y - \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      6. sub-neg83.3%

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{y - z}, y - \left(-z\right), x \cdot x\right)}{y \cdot 2} \]
      7. sub-neg83.3%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, \color{blue}{y + \left(-\left(-z\right)\right)}, x \cdot x\right)}{y \cdot 2} \]
      8. remove-double-neg83.3%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, y + \color{blue}{z}, x \cdot x\right)}{y \cdot 2} \]
    3. Simplified83.3%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y - z, y + z, x \cdot x\right)}{y \cdot 2}} \]
    4. Add Preprocessing

    if 3.2999999999999999e156 < y

    1. Initial program 9.7%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. associate--l+9.7%

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

        \[\leadsto \frac{\color{blue}{\left(y \cdot y - z \cdot z\right) + x \cdot x}}{y \cdot 2} \]
      3. sqr-neg9.7%

        \[\leadsto \frac{\left(y \cdot y - \color{blue}{\left(-z\right) \cdot \left(-z\right)}\right) + x \cdot x}{y \cdot 2} \]
      4. difference-of-squares18.3%

        \[\leadsto \frac{\color{blue}{\left(y + \left(-z\right)\right) \cdot \left(y - \left(-z\right)\right)} + x \cdot x}{y \cdot 2} \]
      5. fma-def20.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + \left(-z\right), y - \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      6. sub-neg20.8%

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{y - z}, y - \left(-z\right), x \cdot x\right)}{y \cdot 2} \]
      7. sub-neg20.8%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, \color{blue}{y + \left(-\left(-z\right)\right)}, x \cdot x\right)}{y \cdot 2} \]
      8. remove-double-neg20.8%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, y + \color{blue}{z}, x \cdot x\right)}{y \cdot 2} \]
    3. Simplified20.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y - z, y + z, x \cdot x\right)}{y \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 18.3%

      \[\leadsto \frac{\color{blue}{\left(y + z\right) \cdot \left(y - z\right)}}{y \cdot 2} \]
    6. Step-by-step derivation
      1. *-commutative18.3%

        \[\leadsto \frac{\color{blue}{\left(y - z\right) \cdot \left(y + z\right)}}{y \cdot 2} \]
      2. times-frac86.1%

        \[\leadsto \color{blue}{\frac{y - z}{y} \cdot \frac{y + z}{2}} \]
    7. Applied egg-rr86.1%

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

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

Alternative 4: 51.2% accurate, 0.7× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 2.06 \cdot 10^{-11} \lor \neg \left(y\_m \leq 4.35 \cdot 10^{+43}\right) \land y\_m \leq 4.2 \cdot 10^{+82}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;y\_m \cdot 0.5\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (or (<= y_m 2.06e-11) (and (not (<= y_m 4.35e+43)) (<= y_m 4.2e+82)))
    (* x (* x (/ 0.5 y_m)))
    (* y_m 0.5))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((y_m <= 2.06e-11) || (!(y_m <= 4.35e+43) && (y_m <= 4.2e+82))) {
		tmp = x * (x * (0.5 / y_m));
	} else {
		tmp = y_m * 0.5;
	}
	return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y_m <= 2.06d-11) .or. (.not. (y_m <= 4.35d+43)) .and. (y_m <= 4.2d+82)) then
        tmp = x * (x * (0.5d0 / y_m))
    else
        tmp = y_m * 0.5d0
    end if
    code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((y_m <= 2.06e-11) || (!(y_m <= 4.35e+43) && (y_m <= 4.2e+82))) {
		tmp = x * (x * (0.5 / y_m));
	} else {
		tmp = y_m * 0.5;
	}
	return y_s * tmp;
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if (y_m <= 2.06e-11) or (not (y_m <= 4.35e+43) and (y_m <= 4.2e+82)):
		tmp = x * (x * (0.5 / y_m))
	else:
		tmp = y_m * 0.5
	return y_s * tmp
y_m = abs(y)
y_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if ((y_m <= 2.06e-11) || (!(y_m <= 4.35e+43) && (y_m <= 4.2e+82)))
		tmp = Float64(x * Float64(x * Float64(0.5 / y_m)));
	else
		tmp = Float64(y_m * 0.5);
	end
	return Float64(y_s * tmp)
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if ((y_m <= 2.06e-11) || (~((y_m <= 4.35e+43)) && (y_m <= 4.2e+82)))
		tmp = x * (x * (0.5 / y_m));
	else
		tmp = y_m * 0.5;
	end
	tmp_2 = y_s * tmp;
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[Or[LessEqual[y$95$m, 2.06e-11], And[N[Not[LessEqual[y$95$m, 4.35e+43]], $MachinePrecision], LessEqual[y$95$m, 4.2e+82]]], N[(x * N[(x * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 2.06 \cdot 10^{-11} \lor \neg \left(y\_m \leq 4.35 \cdot 10^{+43}\right) \land y\_m \leq 4.2 \cdot 10^{+82}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y\_m}\right)\\

\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.0599999999999999e-11 or 4.34999999999999977e43 < y < 4.2e82

    1. Initial program 78.4%

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

      \[\leadsto \frac{\color{blue}{{x}^{2}}}{y \cdot 2} \]
    4. Step-by-step derivation
      1. div-inv36.1%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{y \cdot 2}} \]
      2. metadata-eval36.1%

        \[\leadsto {x}^{2} \cdot \frac{1}{y \cdot \color{blue}{\frac{1}{0.5}}} \]
      3. div-inv36.1%

        \[\leadsto {x}^{2} \cdot \frac{1}{\color{blue}{\frac{y}{0.5}}} \]
      4. clear-num36.1%

        \[\leadsto {x}^{2} \cdot \color{blue}{\frac{0.5}{y}} \]
      5. unpow236.1%

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot \frac{0.5}{y} \]
      6. associate-*l*38.6%

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{0.5}{y}\right)} \]
    5. Applied egg-rr38.6%

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

    if 2.0599999999999999e-11 < y < 4.34999999999999977e43 or 4.2e82 < y

    1. Initial program 39.1%

      \[\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 61.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.06 \cdot 10^{-11} \lor \neg \left(y \leq 4.35 \cdot 10^{+43}\right) \land y \leq 4.2 \cdot 10^{+82}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 51.2% accurate, 0.7× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 1.8 \cdot 10^{-11} \lor \neg \left(y\_m \leq 4.2 \cdot 10^{+43}\right) \land y\_m \leq 1.8 \cdot 10^{+82}:\\ \;\;\;\;\frac{x}{y\_m} \cdot \frac{x}{2}\\ \mathbf{else}:\\ \;\;\;\;y\_m \cdot 0.5\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (or (<= y_m 1.8e-11) (and (not (<= y_m 4.2e+43)) (<= y_m 1.8e+82)))
    (* (/ x y_m) (/ x 2.0))
    (* y_m 0.5))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((y_m <= 1.8e-11) || (!(y_m <= 4.2e+43) && (y_m <= 1.8e+82))) {
		tmp = (x / y_m) * (x / 2.0);
	} else {
		tmp = y_m * 0.5;
	}
	return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y_m <= 1.8d-11) .or. (.not. (y_m <= 4.2d+43)) .and. (y_m <= 1.8d+82)) then
        tmp = (x / y_m) * (x / 2.0d0)
    else
        tmp = y_m * 0.5d0
    end if
    code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((y_m <= 1.8e-11) || (!(y_m <= 4.2e+43) && (y_m <= 1.8e+82))) {
		tmp = (x / y_m) * (x / 2.0);
	} else {
		tmp = y_m * 0.5;
	}
	return y_s * tmp;
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if (y_m <= 1.8e-11) or (not (y_m <= 4.2e+43) and (y_m <= 1.8e+82)):
		tmp = (x / y_m) * (x / 2.0)
	else:
		tmp = y_m * 0.5
	return y_s * tmp
y_m = abs(y)
y_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if ((y_m <= 1.8e-11) || (!(y_m <= 4.2e+43) && (y_m <= 1.8e+82)))
		tmp = Float64(Float64(x / y_m) * Float64(x / 2.0));
	else
		tmp = Float64(y_m * 0.5);
	end
	return Float64(y_s * tmp)
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if ((y_m <= 1.8e-11) || (~((y_m <= 4.2e+43)) && (y_m <= 1.8e+82)))
		tmp = (x / y_m) * (x / 2.0);
	else
		tmp = y_m * 0.5;
	end
	tmp_2 = y_s * tmp;
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[Or[LessEqual[y$95$m, 1.8e-11], And[N[Not[LessEqual[y$95$m, 4.2e+43]], $MachinePrecision], LessEqual[y$95$m, 1.8e+82]]], N[(N[(x / y$95$m), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.8 \cdot 10^{-11} \lor \neg \left(y\_m \leq 4.2 \cdot 10^{+43}\right) \land y\_m \leq 1.8 \cdot 10^{+82}:\\
\;\;\;\;\frac{x}{y\_m} \cdot \frac{x}{2}\\

\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.79999999999999992e-11 or 4.20000000000000003e43 < y < 1.80000000000000007e82

    1. Initial program 78.4%

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

      \[\leadsto \frac{\color{blue}{{x}^{2}}}{y \cdot 2} \]
    4. Step-by-step derivation
      1. unpow236.1%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 2} \]
      2. times-frac38.6%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
    5. Applied egg-rr38.6%

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

    if 1.79999999999999992e-11 < y < 4.20000000000000003e43 or 1.80000000000000007e82 < y

    1. Initial program 39.1%

      \[\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 61.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.8 \cdot 10^{-11} \lor \neg \left(y \leq 4.2 \cdot 10^{+43}\right) \land y \leq 1.8 \cdot 10^{+82}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 50.7% accurate, 0.7× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 1.25 \cdot 10^{-12}:\\ \;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y\_m}\\ \mathbf{elif}\;y\_m \leq 3.35 \cdot 10^{+44} \lor \neg \left(y\_m \leq 4.5 \cdot 10^{+82}\right):\\ \;\;\;\;y\_m \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y\_m} \cdot \frac{x}{2}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= y_m 1.25e-12)
    (/ (* x (* x 0.5)) y_m)
    (if (or (<= y_m 3.35e+44) (not (<= y_m 4.5e+82)))
      (* y_m 0.5)
      (* (/ x y_m) (/ x 2.0))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 1.25e-12) {
		tmp = (x * (x * 0.5)) / y_m;
	} else if ((y_m <= 3.35e+44) || !(y_m <= 4.5e+82)) {
		tmp = y_m * 0.5;
	} else {
		tmp = (x / y_m) * (x / 2.0);
	}
	return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y_m <= 1.25d-12) then
        tmp = (x * (x * 0.5d0)) / y_m
    else if ((y_m <= 3.35d+44) .or. (.not. (y_m <= 4.5d+82))) then
        tmp = y_m * 0.5d0
    else
        tmp = (x / y_m) * (x / 2.0d0)
    end if
    code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 1.25e-12) {
		tmp = (x * (x * 0.5)) / y_m;
	} else if ((y_m <= 3.35e+44) || !(y_m <= 4.5e+82)) {
		tmp = y_m * 0.5;
	} else {
		tmp = (x / y_m) * (x / 2.0);
	}
	return y_s * tmp;
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if y_m <= 1.25e-12:
		tmp = (x * (x * 0.5)) / y_m
	elif (y_m <= 3.35e+44) or not (y_m <= 4.5e+82):
		tmp = y_m * 0.5
	else:
		tmp = (x / y_m) * (x / 2.0)
	return y_s * tmp
y_m = abs(y)
y_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (y_m <= 1.25e-12)
		tmp = Float64(Float64(x * Float64(x * 0.5)) / y_m);
	elseif ((y_m <= 3.35e+44) || !(y_m <= 4.5e+82))
		tmp = Float64(y_m * 0.5);
	else
		tmp = Float64(Float64(x / y_m) * Float64(x / 2.0));
	end
	return Float64(y_s * tmp)
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if (y_m <= 1.25e-12)
		tmp = (x * (x * 0.5)) / y_m;
	elseif ((y_m <= 3.35e+44) || ~((y_m <= 4.5e+82)))
		tmp = y_m * 0.5;
	else
		tmp = (x / y_m) * (x / 2.0);
	end
	tmp_2 = y_s * tmp;
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1.25e-12], N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], If[Or[LessEqual[y$95$m, 3.35e+44], N[Not[LessEqual[y$95$m, 4.5e+82]], $MachinePrecision]], N[(y$95$m * 0.5), $MachinePrecision], N[(N[(x / y$95$m), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)

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

\mathbf{elif}\;y\_m \leq 3.35 \cdot 10^{+44} \lor \neg \left(y\_m \leq 4.5 \cdot 10^{+82}\right):\\
\;\;\;\;y\_m \cdot 0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.24999999999999992e-12

    1. Initial program 78.0%

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

      \[\leadsto \frac{\color{blue}{{x}^{2}}}{y \cdot 2} \]
    4. Step-by-step derivation
      1. div-inv35.9%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{y \cdot 2}} \]
      2. metadata-eval35.9%

        \[\leadsto {x}^{2} \cdot \frac{1}{y \cdot \color{blue}{\frac{1}{0.5}}} \]
      3. div-inv35.9%

        \[\leadsto {x}^{2} \cdot \frac{1}{\color{blue}{\frac{y}{0.5}}} \]
      4. clear-num35.9%

        \[\leadsto {x}^{2} \cdot \color{blue}{\frac{0.5}{y}} \]
      5. unpow235.9%

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot \frac{0.5}{y} \]
      6. associate-*l*38.0%

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{0.5}{y}\right)} \]
    5. Applied egg-rr38.0%

      \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{0.5}{y}\right)} \]
    6. Step-by-step derivation
      1. *-commutative38.0%

        \[\leadsto \color{blue}{\left(x \cdot \frac{0.5}{y}\right) \cdot x} \]
      2. associate-*r/38.0%

        \[\leadsto \color{blue}{\frac{x \cdot 0.5}{y}} \cdot x \]
      3. associate-*l/35.9%

        \[\leadsto \color{blue}{\frac{\left(x \cdot 0.5\right) \cdot x}{y}} \]
    7. Applied egg-rr35.9%

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

    if 1.24999999999999992e-12 < y < 3.35000000000000018e44 or 4.4999999999999997e82 < y

    1. Initial program 39.1%

      \[\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 61.0%

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

    if 3.35000000000000018e44 < y < 4.4999999999999997e82

    1. Initial program 88.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 inf 40.0%

      \[\leadsto \frac{\color{blue}{{x}^{2}}}{y \cdot 2} \]
    4. Step-by-step derivation
      1. unpow240.0%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 2} \]
      2. times-frac51.4%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
    5. Applied egg-rr51.4%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification43.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.25 \cdot 10^{-12}:\\ \;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\ \mathbf{elif}\;y \leq 3.35 \cdot 10^{+44} \lor \neg \left(y \leq 4.5 \cdot 10^{+82}\right):\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 88.7% accurate, 0.7× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 3.3 \cdot 10^{+156}:\\ \;\;\;\;\frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m - z}{y\_m} \cdot \frac{y\_m + z}{2}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= y_m 3.3e+156)
    (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0))
    (* (/ (- y_m z) y_m) (/ (+ y_m z) 2.0)))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 3.3e+156) {
		tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
	} else {
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0);
	}
	return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y_m <= 3.3d+156) then
        tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0d0)
    else
        tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0d0)
    end if
    code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 3.3e+156) {
		tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
	} else {
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0);
	}
	return y_s * tmp;
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if y_m <= 3.3e+156:
		tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)
	else:
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0)
	return y_s * tmp
y_m = abs(y)
y_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (y_m <= 3.3e+156)
		tmp = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0));
	else
		tmp = Float64(Float64(Float64(y_m - z) / y_m) * Float64(Float64(y_m + z) / 2.0));
	end
	return Float64(y_s * tmp)
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if (y_m <= 3.3e+156)
		tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
	else
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0);
	end
	tmp_2 = y_s * tmp;
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 3.3e+156], N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y$95$m - z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(y$95$m + z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)

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

\mathbf{else}:\\
\;\;\;\;\frac{y\_m - z}{y\_m} \cdot \frac{y\_m + z}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.2999999999999999e156

    1. Initial program 78.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing

    if 3.2999999999999999e156 < y

    1. Initial program 9.7%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. associate--l+9.7%

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

        \[\leadsto \frac{\color{blue}{\left(y \cdot y - z \cdot z\right) + x \cdot x}}{y \cdot 2} \]
      3. sqr-neg9.7%

        \[\leadsto \frac{\left(y \cdot y - \color{blue}{\left(-z\right) \cdot \left(-z\right)}\right) + x \cdot x}{y \cdot 2} \]
      4. difference-of-squares18.3%

        \[\leadsto \frac{\color{blue}{\left(y + \left(-z\right)\right) \cdot \left(y - \left(-z\right)\right)} + x \cdot x}{y \cdot 2} \]
      5. fma-def20.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + \left(-z\right), y - \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      6. sub-neg20.8%

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{y - z}, y - \left(-z\right), x \cdot x\right)}{y \cdot 2} \]
      7. sub-neg20.8%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, \color{blue}{y + \left(-\left(-z\right)\right)}, x \cdot x\right)}{y \cdot 2} \]
      8. remove-double-neg20.8%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, y + \color{blue}{z}, x \cdot x\right)}{y \cdot 2} \]
    3. Simplified20.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y - z, y + z, x \cdot x\right)}{y \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 18.3%

      \[\leadsto \frac{\color{blue}{\left(y + z\right) \cdot \left(y - z\right)}}{y \cdot 2} \]
    6. Step-by-step derivation
      1. *-commutative18.3%

        \[\leadsto \frac{\color{blue}{\left(y - z\right) \cdot \left(y + z\right)}}{y \cdot 2} \]
      2. times-frac86.1%

        \[\leadsto \color{blue}{\frac{y - z}{y} \cdot \frac{y + z}{2}} \]
    7. Applied egg-rr86.1%

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

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

Alternative 8: 74.5% accurate, 0.9× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;x \leq 1.5 \cdot 10^{+141}:\\ \;\;\;\;\frac{y\_m - z}{y\_m} \cdot \frac{y\_m + z}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y\_m \cdot \frac{2}{x}}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= x 1.5e+141)
    (* (/ (- y_m z) y_m) (/ (+ y_m z) 2.0))
    (/ x (* y_m (/ 2.0 x))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (x <= 1.5e+141) {
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0);
	} else {
		tmp = x / (y_m * (2.0 / x));
	}
	return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= 1.5d+141) then
        tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0d0)
    else
        tmp = x / (y_m * (2.0d0 / x))
    end if
    code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (x <= 1.5e+141) {
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0);
	} else {
		tmp = x / (y_m * (2.0 / x));
	}
	return y_s * tmp;
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if x <= 1.5e+141:
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0)
	else:
		tmp = x / (y_m * (2.0 / x))
	return y_s * tmp
y_m = abs(y)
y_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (x <= 1.5e+141)
		tmp = Float64(Float64(Float64(y_m - z) / y_m) * Float64(Float64(y_m + z) / 2.0));
	else
		tmp = Float64(x / Float64(y_m * Float64(2.0 / x)));
	end
	return Float64(y_s * tmp)
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if (x <= 1.5e+141)
		tmp = ((y_m - z) / y_m) * ((y_m + z) / 2.0);
	else
		tmp = x / (y_m * (2.0 / x));
	end
	tmp_2 = y_s * tmp;
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 1.5e+141], N[(N[(N[(y$95$m - z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(y$95$m + z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(y$95$m * N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.5 \cdot 10^{+141}:\\
\;\;\;\;\frac{y\_m - z}{y\_m} \cdot \frac{y\_m + z}{2}\\

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


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

    1. Initial program 71.0%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. associate--l+71.0%

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

        \[\leadsto \frac{\color{blue}{\left(y \cdot y - z \cdot z\right) + x \cdot x}}{y \cdot 2} \]
      3. sqr-neg71.0%

        \[\leadsto \frac{\left(y \cdot y - \color{blue}{\left(-z\right) \cdot \left(-z\right)}\right) + x \cdot x}{y \cdot 2} \]
      4. difference-of-squares73.3%

        \[\leadsto \frac{\color{blue}{\left(y + \left(-z\right)\right) \cdot \left(y - \left(-z\right)\right)} + x \cdot x}{y \cdot 2} \]
      5. fma-def74.6%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + \left(-z\right), y - \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      6. sub-neg74.6%

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{y - z}, y - \left(-z\right), x \cdot x\right)}{y \cdot 2} \]
      7. sub-neg74.6%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, \color{blue}{y + \left(-\left(-z\right)\right)}, x \cdot x\right)}{y \cdot 2} \]
      8. remove-double-neg74.6%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, y + \color{blue}{z}, x \cdot x\right)}{y \cdot 2} \]
    3. Simplified74.6%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y - z, y + z, x \cdot x\right)}{y \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 54.4%

      \[\leadsto \frac{\color{blue}{\left(y + z\right) \cdot \left(y - z\right)}}{y \cdot 2} \]
    6. Step-by-step derivation
      1. *-commutative54.4%

        \[\leadsto \frac{\color{blue}{\left(y - z\right) \cdot \left(y + z\right)}}{y \cdot 2} \]
      2. times-frac76.6%

        \[\leadsto \color{blue}{\frac{y - z}{y} \cdot \frac{y + z}{2}} \]
    7. Applied egg-rr76.6%

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

    if 1.4999999999999999e141 < x

    1. Initial program 46.5%

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

      \[\leadsto \frac{\color{blue}{{x}^{2}}}{y \cdot 2} \]
    4. Step-by-step derivation
      1. unpow265.4%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 2} \]
      2. times-frac79.6%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
    5. Applied egg-rr79.6%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
    6. Step-by-step derivation
      1. *-commutative79.6%

        \[\leadsto \color{blue}{\frac{x}{2} \cdot \frac{x}{y}} \]
      2. clear-num79.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{2}{x}}} \cdot \frac{x}{y} \]
      3. frac-times79.6%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{2}{x} \cdot y}} \]
      4. *-un-lft-identity79.6%

        \[\leadsto \frac{\color{blue}{x}}{\frac{2}{x} \cdot y} \]
    7. Applied egg-rr79.6%

      \[\leadsto \color{blue}{\frac{x}{\frac{2}{x} \cdot y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification77.1%

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

Alternative 9: 74.5% accurate, 0.9× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;x \leq 8.6 \cdot 10^{+143}:\\ \;\;\;\;\frac{y\_m + z}{\frac{y\_m \cdot 2}{y\_m - z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y\_m \cdot \frac{2}{x}}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= x 8.6e+143)
    (/ (+ y_m z) (/ (* y_m 2.0) (- y_m z)))
    (/ x (* y_m (/ 2.0 x))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (x <= 8.6e+143) {
		tmp = (y_m + z) / ((y_m * 2.0) / (y_m - z));
	} else {
		tmp = x / (y_m * (2.0 / x));
	}
	return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= 8.6d+143) then
        tmp = (y_m + z) / ((y_m * 2.0d0) / (y_m - z))
    else
        tmp = x / (y_m * (2.0d0 / x))
    end if
    code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (x <= 8.6e+143) {
		tmp = (y_m + z) / ((y_m * 2.0) / (y_m - z));
	} else {
		tmp = x / (y_m * (2.0 / x));
	}
	return y_s * tmp;
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if x <= 8.6e+143:
		tmp = (y_m + z) / ((y_m * 2.0) / (y_m - z))
	else:
		tmp = x / (y_m * (2.0 / x))
	return y_s * tmp
y_m = abs(y)
y_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (x <= 8.6e+143)
		tmp = Float64(Float64(y_m + z) / Float64(Float64(y_m * 2.0) / Float64(y_m - z)));
	else
		tmp = Float64(x / Float64(y_m * Float64(2.0 / x)));
	end
	return Float64(y_s * tmp)
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if (x <= 8.6e+143)
		tmp = (y_m + z) / ((y_m * 2.0) / (y_m - z));
	else
		tmp = x / (y_m * (2.0 / x));
	end
	tmp_2 = y_s * tmp;
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 8.6e+143], N[(N[(y$95$m + z), $MachinePrecision] / N[(N[(y$95$m * 2.0), $MachinePrecision] / N[(y$95$m - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y$95$m * N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 8.6 \cdot 10^{+143}:\\
\;\;\;\;\frac{y\_m + z}{\frac{y\_m \cdot 2}{y\_m - z}}\\

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


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

    1. Initial program 71.0%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. associate--l+71.0%

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

        \[\leadsto \frac{\color{blue}{\left(y \cdot y - z \cdot z\right) + x \cdot x}}{y \cdot 2} \]
      3. sqr-neg71.0%

        \[\leadsto \frac{\left(y \cdot y - \color{blue}{\left(-z\right) \cdot \left(-z\right)}\right) + x \cdot x}{y \cdot 2} \]
      4. difference-of-squares73.3%

        \[\leadsto \frac{\color{blue}{\left(y + \left(-z\right)\right) \cdot \left(y - \left(-z\right)\right)} + x \cdot x}{y \cdot 2} \]
      5. fma-def74.6%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + \left(-z\right), y - \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      6. sub-neg74.6%

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{y - z}, y - \left(-z\right), x \cdot x\right)}{y \cdot 2} \]
      7. sub-neg74.6%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, \color{blue}{y + \left(-\left(-z\right)\right)}, x \cdot x\right)}{y \cdot 2} \]
      8. remove-double-neg74.6%

        \[\leadsto \frac{\mathsf{fma}\left(y - z, y + \color{blue}{z}, x \cdot x\right)}{y \cdot 2} \]
    3. Simplified74.6%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y - z, y + z, x \cdot x\right)}{y \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 54.4%

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

        \[\leadsto \color{blue}{\frac{y + z}{\frac{y \cdot 2}{y - z}}} \]
      2. div-inv76.6%

        \[\leadsto \color{blue}{\left(y + z\right) \cdot \frac{1}{\frac{y \cdot 2}{y - z}}} \]
      3. *-commutative76.6%

        \[\leadsto \left(y + z\right) \cdot \frac{1}{\frac{\color{blue}{2 \cdot y}}{y - z}} \]
      4. *-un-lft-identity76.6%

        \[\leadsto \left(y + z\right) \cdot \frac{1}{\frac{2 \cdot y}{\color{blue}{1 \cdot \left(y - z\right)}}} \]
      5. times-frac76.6%

        \[\leadsto \left(y + z\right) \cdot \frac{1}{\color{blue}{\frac{2}{1} \cdot \frac{y}{y - z}}} \]
      6. metadata-eval76.6%

        \[\leadsto \left(y + z\right) \cdot \frac{1}{\color{blue}{2} \cdot \frac{y}{y - z}} \]
    7. Applied egg-rr76.6%

      \[\leadsto \color{blue}{\left(y + z\right) \cdot \frac{1}{2 \cdot \frac{y}{y - z}}} \]
    8. Step-by-step derivation
      1. associate-*r/76.6%

        \[\leadsto \color{blue}{\frac{\left(y + z\right) \cdot 1}{2 \cdot \frac{y}{y - z}}} \]
      2. *-rgt-identity76.6%

        \[\leadsto \frac{\color{blue}{y + z}}{2 \cdot \frac{y}{y - z}} \]
      3. associate-*r/76.6%

        \[\leadsto \frac{y + z}{\color{blue}{\frac{2 \cdot y}{y - z}}} \]
      4. *-commutative76.6%

        \[\leadsto \frac{y + z}{\frac{\color{blue}{y \cdot 2}}{y - z}} \]
    9. Simplified76.6%

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

    if 8.60000000000000003e143 < x

    1. Initial program 46.5%

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

      \[\leadsto \frac{\color{blue}{{x}^{2}}}{y \cdot 2} \]
    4. Step-by-step derivation
      1. unpow265.4%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 2} \]
      2. times-frac79.6%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
    5. Applied egg-rr79.6%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
    6. Step-by-step derivation
      1. *-commutative79.6%

        \[\leadsto \color{blue}{\frac{x}{2} \cdot \frac{x}{y}} \]
      2. clear-num79.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{2}{x}}} \cdot \frac{x}{y} \]
      3. frac-times79.6%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{2}{x} \cdot y}} \]
      4. *-un-lft-identity79.6%

        \[\leadsto \frac{\color{blue}{x}}{\frac{2}{x} \cdot y} \]
    7. Applied egg-rr79.6%

      \[\leadsto \color{blue}{\frac{x}{\frac{2}{x} \cdot y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification77.1%

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

Alternative 10: 33.9% accurate, 5.0× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \left(y\_m \cdot 0.5\right) \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z) :precision binary64 (* y_s (* y_m 0.5)))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	return y_s * (y_m * 0.5);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    code = y_s * (y_m * 0.5d0)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	return y_s * (y_m * 0.5);
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	return y_s * (y_m * 0.5)
y_m = abs(y)
y_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	return Float64(y_s * Float64(y_m * 0.5))
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
function tmp = code(y_s, x, y_m, z)
	tmp = y_s * (y_m * 0.5);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(y$95$m * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \left(y\_m \cdot 0.5\right)
\end{array}
Derivation
  1. Initial program 67.4%

    \[\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 34.7%

    \[\leadsto \color{blue}{0.5 \cdot y} \]
  4. Final simplification34.7%

    \[\leadsto y \cdot 0.5 \]
  5. Add Preprocessing

Developer target: 99.9% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2024031 
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
  :precision binary64

  :herbie-target
  (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))

  (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))