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

Percentage Accurate: 68.6% → 96.0%
Time: 9.8s
Alternatives: 6
Speedup: 0.7×

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

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

Initial Program: 68.6% accurate, 1.0× speedup?

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

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

Alternative 1: 96.0% 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 8.2 \cdot 10^{+52}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y\_m, y\_m, \mathsf{fma}\left(x, x, z \cdot \left(-z\right)\right)\right)}{y\_m \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(y\_m - \frac{z}{\frac{y\_m}{z}}\right) + x \cdot \frac{x}{y\_m}\right)\\ \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 8.2e+52)
    (/ (fma y_m y_m (fma x x (* z (- z)))) (* y_m 2.0))
    (* 0.5 (+ (- y_m (/ z (/ y_m z))) (* x (/ x y_m)))))))
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 <= 8.2e+52) {
		tmp = fma(y_m, y_m, fma(x, x, (z * -z))) / (y_m * 2.0);
	} else {
		tmp = 0.5 * ((y_m - (z / (y_m / z))) + (x * (x / y_m)));
	}
	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 <= 8.2e+52)
		tmp = Float64(fma(y_m, y_m, fma(x, x, Float64(z * Float64(-z)))) / Float64(y_m * 2.0));
	else
		tmp = Float64(0.5 * Float64(Float64(y_m - Float64(z / Float64(y_m / z))) + Float64(x * Float64(x / y_m))));
	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, 8.2e+52], N[(N[(y$95$m * y$95$m + N[(x * x + N[(z * (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y$95$m - N[(z / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(x / y$95$m), $MachinePrecision]), $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}\;y\_m \leq 8.2 \cdot 10^{+52}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y\_m, y\_m, \mathsf{fma}\left(x, x, z \cdot \left(-z\right)\right)\right)}{y\_m \cdot 2}\\

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


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

    1. Initial program 70.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(y \cdot y + x \cdot x\right)} + \left(-z \cdot z\right)}{y \cdot 2} \]
      10. cancel-sign-sub70.8%

        \[\leadsto \frac{\color{blue}{\left(y \cdot y - \left(-x\right) \cdot x\right)} + \left(-z \cdot z\right)}{y \cdot 2} \]
      11. associate-+l-70.8%

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

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

    if 8.1999999999999999e52 < y

    1. Initial program 38.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 0 38.5%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{y}^{2} - {z}^{2}}{y} + 0.5 \cdot \frac{{x}^{2}}{y}} \]
    4. Step-by-step derivation
      1. distribute-lft-out38.5%

        \[\leadsto \color{blue}{0.5 \cdot \left(\frac{{y}^{2} - {z}^{2}}{y} + \frac{{x}^{2}}{y}\right)} \]
      2. div-sub38.5%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(\frac{{y}^{2}}{y} - \frac{{z}^{2}}{y}\right)} + \frac{{x}^{2}}{y}\right) \]
      3. associate-+l-38.5%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{{y}^{2}}{y} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right)} \]
      4. unpow238.5%

        \[\leadsto 0.5 \cdot \left(\frac{\color{blue}{y \cdot y}}{y} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right) \]
      5. associate-/l*67.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{y \cdot \frac{y}{y}} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right) \]
      6. *-inverses67.8%

        \[\leadsto 0.5 \cdot \left(y \cdot \color{blue}{1} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right) \]
      7. *-rgt-identity67.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{y} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right) \]
      8. associate-+l-67.8%

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

      \[\leadsto \color{blue}{0.5 \cdot \left(\left(y - \frac{{z}^{2}}{y}\right) + \frac{{x}^{2}}{y}\right)} \]
    6. Step-by-step derivation
      1. unpow267.8%

        \[\leadsto 0.5 \cdot \left(\left(y - \frac{\color{blue}{z \cdot z}}{y}\right) + \frac{{x}^{2}}{y}\right) \]
      2. associate-/l*76.5%

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

      \[\leadsto 0.5 \cdot \left(\left(y - \color{blue}{z \cdot \frac{z}{y}}\right) + \frac{{x}^{2}}{y}\right) \]
    8. Step-by-step derivation
      1. unpow276.5%

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

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

      \[\leadsto 0.5 \cdot \left(\left(y - z \cdot \frac{z}{y}\right) + \color{blue}{x \cdot \frac{x}{y}}\right) \]
    10. Step-by-step derivation
      1. clear-num99.9%

        \[\leadsto 0.5 \cdot \left(\left(y - z \cdot \color{blue}{\frac{1}{\frac{y}{z}}}\right) + x \cdot \frac{x}{y}\right) \]
      2. un-div-inv100.0%

        \[\leadsto 0.5 \cdot \left(\left(y - \color{blue}{\frac{z}{\frac{y}{z}}}\right) + x \cdot \frac{x}{y}\right) \]
    11. Applied egg-rr100.0%

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

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

Alternative 2: 92.1% 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}\;x \leq 1.5 \cdot 10^{+219}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y\_m} + \left(y\_m - z \cdot \frac{z}{y\_m}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y\_m}\right)\\ \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+219)
    (* 0.5 (+ (* x (/ x y_m)) (- y_m (* z (/ z y_m)))))
    (* x (* x (/ 0.5 y_m))))))
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+219) {
		tmp = 0.5 * ((x * (x / y_m)) + (y_m - (z * (z / y_m))));
	} else {
		tmp = x * (x * (0.5 / y_m));
	}
	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+219) then
        tmp = 0.5d0 * ((x * (x / y_m)) + (y_m - (z * (z / y_m))))
    else
        tmp = x * (x * (0.5d0 / y_m))
    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+219) {
		tmp = 0.5 * ((x * (x / y_m)) + (y_m - (z * (z / y_m))));
	} else {
		tmp = x * (x * (0.5 / y_m));
	}
	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+219:
		tmp = 0.5 * ((x * (x / y_m)) + (y_m - (z * (z / y_m))))
	else:
		tmp = x * (x * (0.5 / y_m))
	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+219)
		tmp = Float64(0.5 * Float64(Float64(x * Float64(x / y_m)) + Float64(y_m - Float64(z * Float64(z / y_m)))));
	else
		tmp = Float64(x * Float64(x * Float64(0.5 / y_m)));
	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+219)
		tmp = 0.5 * ((x * (x / y_m)) + (y_m - (z * (z / y_m))));
	else
		tmp = x * (x * (0.5 / y_m));
	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+219], N[(0.5 * N[(N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision] + N[(y$95$m - N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(x * N[(0.5 / y$95$m), $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^{+219}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y\_m} + \left(y\_m - z \cdot \frac{z}{y\_m}\right)\right)\\

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


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

    1. Initial program 65.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 0 61.3%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{y}^{2} - {z}^{2}}{y} + 0.5 \cdot \frac{{x}^{2}}{y}} \]
    4. Step-by-step derivation
      1. distribute-lft-out61.3%

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(\frac{{y}^{2}}{y} - \frac{{z}^{2}}{y}\right)} + \frac{{x}^{2}}{y}\right) \]
      3. associate-+l-61.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{{y}^{2}}{y} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right)} \]
      4. unpow261.3%

        \[\leadsto 0.5 \cdot \left(\frac{\color{blue}{y \cdot y}}{y} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right) \]
      5. associate-/l*78.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{y \cdot \frac{y}{y}} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right) \]
      6. *-inverses78.0%

        \[\leadsto 0.5 \cdot \left(y \cdot \color{blue}{1} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right) \]
      7. *-rgt-identity78.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{y} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right) \]
      8. associate-+l-78.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \left(\left(y - \frac{{z}^{2}}{y}\right) + \frac{{x}^{2}}{y}\right)} \]
    6. Step-by-step derivation
      1. unpow278.0%

        \[\leadsto 0.5 \cdot \left(\left(y - \frac{\color{blue}{z \cdot z}}{y}\right) + \frac{{x}^{2}}{y}\right) \]
      2. associate-/l*83.8%

        \[\leadsto 0.5 \cdot \left(\left(y - \color{blue}{z \cdot \frac{z}{y}}\right) + \frac{{x}^{2}}{y}\right) \]
    7. Applied egg-rr83.8%

      \[\leadsto 0.5 \cdot \left(\left(y - \color{blue}{z \cdot \frac{z}{y}}\right) + \frac{{x}^{2}}{y}\right) \]
    8. Step-by-step derivation
      1. unpow283.8%

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

        \[\leadsto 0.5 \cdot \left(\left(y - z \cdot \frac{z}{y}\right) + \color{blue}{x \cdot \frac{x}{y}}\right) \]
    9. Applied egg-rr90.2%

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

    if 1.4999999999999999e219 < x

    1. Initial program 60.7%

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

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

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

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot \frac{1}{y \cdot 2} \]
      3. associate-*l*95.0%

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{1}{y \cdot 2}\right)} \]
      4. *-commutative95.0%

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

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

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

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

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

Alternative 3: 92.1% 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}\;x \leq 7.5 \cdot 10^{+218}:\\ \;\;\;\;0.5 \cdot \left(\left(y\_m - z \cdot \frac{z}{y\_m}\right) + \frac{x}{\frac{y\_m}{x}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y\_m}\right)\\ \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 7.5e+218)
    (* 0.5 (+ (- y_m (* z (/ z y_m))) (/ x (/ y_m x))))
    (* x (* x (/ 0.5 y_m))))))
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 <= 7.5e+218) {
		tmp = 0.5 * ((y_m - (z * (z / y_m))) + (x / (y_m / x)));
	} else {
		tmp = x * (x * (0.5 / y_m));
	}
	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 <= 7.5d+218) then
        tmp = 0.5d0 * ((y_m - (z * (z / y_m))) + (x / (y_m / x)))
    else
        tmp = x * (x * (0.5d0 / y_m))
    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 <= 7.5e+218) {
		tmp = 0.5 * ((y_m - (z * (z / y_m))) + (x / (y_m / x)));
	} else {
		tmp = x * (x * (0.5 / y_m));
	}
	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 <= 7.5e+218:
		tmp = 0.5 * ((y_m - (z * (z / y_m))) + (x / (y_m / x)))
	else:
		tmp = x * (x * (0.5 / y_m))
	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 <= 7.5e+218)
		tmp = Float64(0.5 * Float64(Float64(y_m - Float64(z * Float64(z / y_m))) + Float64(x / Float64(y_m / x))));
	else
		tmp = Float64(x * Float64(x * Float64(0.5 / y_m)));
	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 <= 7.5e+218)
		tmp = 0.5 * ((y_m - (z * (z / y_m))) + (x / (y_m / x)));
	else
		tmp = x * (x * (0.5 / y_m));
	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, 7.5e+218], N[(0.5 * N[(N[(y$95$m - N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(x * N[(0.5 / y$95$m), $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 7.5 \cdot 10^{+218}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m - z \cdot \frac{z}{y\_m}\right) + \frac{x}{\frac{y\_m}{x}}\right)\\

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


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

    1. Initial program 65.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 0 61.3%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{y}^{2} - {z}^{2}}{y} + 0.5 \cdot \frac{{x}^{2}}{y}} \]
    4. Step-by-step derivation
      1. distribute-lft-out61.3%

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(\frac{{y}^{2}}{y} - \frac{{z}^{2}}{y}\right)} + \frac{{x}^{2}}{y}\right) \]
      3. associate-+l-61.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{{y}^{2}}{y} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right)} \]
      4. unpow261.3%

        \[\leadsto 0.5 \cdot \left(\frac{\color{blue}{y \cdot y}}{y} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right) \]
      5. associate-/l*78.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{y \cdot \frac{y}{y}} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right) \]
      6. *-inverses78.0%

        \[\leadsto 0.5 \cdot \left(y \cdot \color{blue}{1} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right) \]
      7. *-rgt-identity78.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{y} - \left(\frac{{z}^{2}}{y} - \frac{{x}^{2}}{y}\right)\right) \]
      8. associate-+l-78.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \left(\left(y - \frac{{z}^{2}}{y}\right) + \frac{{x}^{2}}{y}\right)} \]
    6. Step-by-step derivation
      1. unpow278.0%

        \[\leadsto 0.5 \cdot \left(\left(y - \frac{\color{blue}{z \cdot z}}{y}\right) + \frac{{x}^{2}}{y}\right) \]
      2. associate-/l*83.8%

        \[\leadsto 0.5 \cdot \left(\left(y - \color{blue}{z \cdot \frac{z}{y}}\right) + \frac{{x}^{2}}{y}\right) \]
    7. Applied egg-rr83.8%

      \[\leadsto 0.5 \cdot \left(\left(y - \color{blue}{z \cdot \frac{z}{y}}\right) + \frac{{x}^{2}}{y}\right) \]
    8. Step-by-step derivation
      1. unpow283.8%

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

        \[\leadsto 0.5 \cdot \left(\left(y - z \cdot \frac{z}{y}\right) + \color{blue}{x \cdot \frac{x}{y}}\right) \]
    9. Applied egg-rr90.2%

      \[\leadsto 0.5 \cdot \left(\left(y - z \cdot \frac{z}{y}\right) + \color{blue}{x \cdot \frac{x}{y}}\right) \]
    10. Step-by-step derivation
      1. clear-num90.2%

        \[\leadsto 0.5 \cdot \left(\left(y - z \cdot \frac{z}{y}\right) + x \cdot \color{blue}{\frac{1}{\frac{y}{x}}}\right) \]
      2. un-div-inv90.2%

        \[\leadsto 0.5 \cdot \left(\left(y - z \cdot \frac{z}{y}\right) + \color{blue}{\frac{x}{\frac{y}{x}}}\right) \]
    11. Applied egg-rr90.2%

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

    if 7.4999999999999993e218 < x

    1. Initial program 60.7%

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

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

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

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot \frac{1}{y \cdot 2} \]
      3. associate-*l*95.0%

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{1}{y \cdot 2}\right)} \]
      4. *-commutative95.0%

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

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

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

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

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

Alternative 4: 53.2% accurate, 1.2× 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 5.4 \cdot 10^{+44}:\\ \;\;\;\;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 (<= y_m 5.4e+44) (* 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 <= 5.4e+44) {
		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 <= 5.4d+44) 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 <= 5.4e+44) {
		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 <= 5.4e+44:
		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 <= 5.4e+44)
		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 <= 5.4e+44)
		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[LessEqual[y$95$m, 5.4e+44], 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 5.4 \cdot 10^{+44}:\\
\;\;\;\;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 < 5.4e44

    1. Initial program 70.7%

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{1}{y \cdot 2}\right)} \]
      4. *-commutative38.0%

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

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

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

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

    if 5.4e44 < y

    1. Initial program 39.9%

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

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

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

Alternative 5: 53.2% accurate, 1.2× 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 4.4 \cdot 10^{+44}:\\ \;\;\;\;\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 (<= y_m 4.4e+44) (* (/ 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 <= 4.4e+44) {
		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 <= 4.4d+44) 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 <= 4.4e+44) {
		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 <= 4.4e+44:
		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 <= 4.4e+44)
		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 <= 4.4e+44)
		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[LessEqual[y$95$m, 4.4e+44], 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 4.4 \cdot 10^{+44}:\\
\;\;\;\;\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 < 4.39999999999999991e44

    1. Initial program 70.7%

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

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

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

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

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

    if 4.39999999999999991e44 < y

    1. Initial program 39.9%

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

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

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

Alternative 6: 34.5% 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 65.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 33.4%

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

    \[\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 2024046 
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
  :precision binary64

  :alt
  (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))

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