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

Percentage Accurate: 69.0% → 99.9%
Time: 22.9s
Alternatives: 9
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 69.0% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.2× speedup?

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

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

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

      \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
    2. distribute-lft-neg-out71.2%

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

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

      \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
    5. neg-mul-171.2%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
    6. distribute-lft-neg-out71.2%

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

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
    8. distribute-lft-neg-in71.2%

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

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

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

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

      \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
    13. fma-define73.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.5 \cdot \left(y + \color{blue}{\left(x + z\right) \cdot \frac{x - z}{y}}\right) \]
  12. Final simplification99.9%

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

Alternative 2: 73.4% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;y \leq 4.4 \cdot 10^{+191}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z\_m \cdot z\_m}{y}\right)\\

\mathbf{elif}\;y \leq 1.1 \cdot 10^{+224}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 5.10000000000000014e70 or 4.4e191 < y < 1.1e224

    1. Initial program 77.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-177.3%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out77.3%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in77.3%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define79.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.10000000000000014e70 < y < 4.4e191

    1. Initial program 52.9%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out52.9%

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

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

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-152.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out52.9%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval52.9%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval52.9%

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define57.9%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \left(y + \frac{z \cdot \color{blue}{\left(-1 \cdot z\right)}}{y}\right) \]
    12. Step-by-step derivation
      1. neg-mul-167.6%

        \[\leadsto 0.5 \cdot \left(y + \frac{z \cdot \color{blue}{\left(-z\right)}}{y}\right) \]
    13. Simplified67.6%

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

    if 1.1e224 < y

    1. Initial program 5.9%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out5.9%

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

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

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-15.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out5.9%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval5.9%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval5.9%

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define5.9%

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

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

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

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

Alternative 3: 86.5% accurate, 0.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(t\_0 \cdot \left(x\_m + z\_m\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 2.0000000000000001e206

    1. Initial program 71.4%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out71.4%

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

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

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-171.4%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out71.4%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in71.4%

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

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval71.4%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval71.4%

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define71.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e206 < (*.f64 x x)

    1. Initial program 70.9%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out70.9%

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

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

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-170.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out70.9%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval70.9%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval70.9%

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define76.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 88.6% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 3.30000000000000006e-44

    1. Initial program 73.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-173.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out73.0%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in73.0%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define75.3%

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

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

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

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

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

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

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

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

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

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

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

    if 3.30000000000000006e-44 < z

    1. Initial program 67.4%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out67.4%

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

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

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-167.4%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out67.4%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in67.4%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 75.2% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 2.00000000000000013e260

    1. Initial program 73.1%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out73.1%

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

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg73.1%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-173.1%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out73.1%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in73.1%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define73.1%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \left(y + \frac{z \cdot \color{blue}{\left(-1 \cdot z\right)}}{y}\right) \]
    12. Step-by-step derivation
      1. neg-mul-173.3%

        \[\leadsto 0.5 \cdot \left(y + \frac{z \cdot \color{blue}{\left(-z\right)}}{y}\right) \]
    13. Simplified73.3%

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

    if 2.00000000000000013e260 < (*.f64 x x)

    1. Initial program 67.1%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out67.1%

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

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg67.1%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-167.1%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out67.1%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in67.1%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define73.2%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{x}^{2} \cdot 0.5}{y}} \]
      3. associate-*r/76.3%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{0.5}{y}} \]
    7. Simplified76.3%

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

        \[\leadsto \color{blue}{\frac{{x}^{2} \cdot 0.5}{y}} \]
      2. clear-num76.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(x \cdot x\right)}{y}} \]
      3. *-commutative76.3%

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{0.5}{y}\right)} \]
    12. Taylor expanded in x around 0 83.8%

      \[\leadsto x \cdot \color{blue}{\left(0.5 \cdot \frac{x}{y}\right)} \]
    13. Step-by-step derivation
      1. associate-*r/83.8%

        \[\leadsto x \cdot \color{blue}{\frac{0.5 \cdot x}{y}} \]
      2. *-commutative83.8%

        \[\leadsto x \cdot \frac{\color{blue}{x \cdot 0.5}}{y} \]
    14. Simplified83.8%

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

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

Alternative 6: 55.2% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 77.2%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out77.2%

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

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

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-177.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out77.2%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in77.2%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define79.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.05000000000000002e36 < y

    1. Initial program 38.8%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out38.8%

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

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

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-138.8%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out38.8%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in38.8%

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

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

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval38.8%

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define41.3%

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

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

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

Alternative 7: 52.0% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x\_m \cdot x\_m \leq 10^{+215}:\\
\;\;\;\;0.5 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 9.99999999999999907e214

    1. Initial program 71.6%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out71.6%

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

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg71.6%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-171.6%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out71.6%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in71.6%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define71.6%

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

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

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

    if 9.99999999999999907e214 < (*.f64 x x)

    1. Initial program 70.6%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out70.6%

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

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

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-170.6%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out70.6%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in70.6%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define75.8%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{x}^{2} \cdot 0.5}{y}} \]
      3. associate-*r/72.3%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{0.5}{y}} \]
    7. Simplified72.3%

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

        \[\leadsto \color{blue}{\frac{{x}^{2} \cdot 0.5}{y}} \]
      2. clear-num72.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(x \cdot x\right)}{y}} \]
      3. *-commutative72.3%

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

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

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{0.5}{y}\right)} \]
    11. Applied egg-rr78.8%

      \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{0.5}{y}\right)} \]
    12. Taylor expanded in x around 0 78.8%

      \[\leadsto x \cdot \color{blue}{\left(0.5 \cdot \frac{x}{y}\right)} \]
    13. Step-by-step derivation
      1. associate-*r/78.8%

        \[\leadsto x \cdot \color{blue}{\frac{0.5 \cdot x}{y}} \]
      2. *-commutative78.8%

        \[\leadsto x \cdot \frac{\color{blue}{x \cdot 0.5}}{y} \]
    14. Simplified78.8%

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

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

Alternative 8: 52.0% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 4.2 \cdot 10^{+107}:\\
\;\;\;\;0.5 \cdot y\\

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


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

    1. Initial program 72.1%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out72.1%

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

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg72.1%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-172.1%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out72.1%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in72.1%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define72.6%

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

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

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

    if 4.1999999999999999e107 < x

    1. Initial program 67.2%

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

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out67.2%

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

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

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-167.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out67.2%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in67.2%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define75.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{x}^{2} \cdot 0.5}{y}} \]
      3. associate-*r/64.3%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{0.5}{y}} \]
    7. Simplified64.3%

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

        \[\leadsto \color{blue}{\frac{{x}^{2} \cdot 0.5}{y}} \]
      2. clear-num64.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(x \cdot x\right)}{y}} \]
      3. *-commutative64.3%

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

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

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{0.5}{y}\right)} \]
    11. Applied egg-rr71.8%

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

Alternative 9: 34.2% accurate, 5.0× speedup?

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

\\
0.5 \cdot y
\end{array}
Derivation
  1. Initial program 71.2%

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

      \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
    2. distribute-lft-neg-out71.2%

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

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

      \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
    5. neg-mul-171.2%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
    6. distribute-lft-neg-out71.2%

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

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
    8. distribute-lft-neg-in71.2%

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

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

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

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

      \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
    13. fma-define73.1%

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

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

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

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

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

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

Reproduce

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

  :alt
  (! :herbie-platform default (- (* y 1/2) (* (* (/ 1/2 y) (+ z x)) (- z x))))

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