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

Percentage Accurate: 70.1% → 99.9%
Time: 12.5s
Alternatives: 12
Speedup: 1.4×

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

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

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

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

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

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

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

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

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

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

    \[\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+74.5%

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

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

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

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

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

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

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

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

Alternative 2: 53.0% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-79}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;x \cdot x \leq 0.02:\\
\;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\

\mathbf{elif}\;x \cdot x \leq 10^{+155}:\\
\;\;\;\;0.5 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x x) < 5.0000000000000002e-154

    1. Initial program 68.9%

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

      \[\leadsto \frac{\color{blue}{-1 \cdot {z}^{2}}}{y \cdot 2} \]
    3. Step-by-step derivation
      1. mul-1-neg48.9%

        \[\leadsto \frac{\color{blue}{-{z}^{2}}}{y \cdot 2} \]
      2. unpow248.9%

        \[\leadsto \frac{-\color{blue}{z \cdot z}}{y \cdot 2} \]
      3. distribute-rgt-neg-in48.9%

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

      \[\leadsto \frac{\color{blue}{z \cdot \left(-z\right)}}{y \cdot 2} \]
    5. Step-by-step derivation
      1. times-frac55.9%

        \[\leadsto \color{blue}{\frac{z}{y} \cdot \frac{-z}{2}} \]
      2. metadata-eval55.9%

        \[\leadsto \frac{z}{y} \cdot \frac{-z}{\color{blue}{--2}} \]
      3. frac-2neg55.9%

        \[\leadsto \frac{z}{y} \cdot \color{blue}{\frac{z}{-2}} \]
      4. div-inv55.9%

        \[\leadsto \frac{z}{y} \cdot \color{blue}{\left(z \cdot \frac{1}{-2}\right)} \]
      5. metadata-eval55.9%

        \[\leadsto \frac{z}{y} \cdot \left(z \cdot \color{blue}{-0.5}\right) \]
      6. *-commutative55.9%

        \[\leadsto \frac{z}{y} \cdot \color{blue}{\left(-0.5 \cdot z\right)} \]
      7. associate-*r*55.9%

        \[\leadsto \color{blue}{\left(\frac{z}{y} \cdot -0.5\right) \cdot z} \]
      8. div-inv55.9%

        \[\leadsto \left(\color{blue}{\left(z \cdot \frac{1}{y}\right)} \cdot -0.5\right) \cdot z \]
      9. associate-*l*55.9%

        \[\leadsto \color{blue}{\left(z \cdot \left(\frac{1}{y} \cdot -0.5\right)\right)} \cdot z \]
      10. metadata-eval55.9%

        \[\leadsto \left(z \cdot \left(\frac{1}{y} \cdot \color{blue}{\frac{1}{-2}}\right)\right) \cdot z \]
      11. div-inv55.9%

        \[\leadsto \left(z \cdot \color{blue}{\frac{\frac{1}{y}}{-2}}\right) \cdot z \]
      12. associate-/l/55.9%

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

        \[\leadsto \left(z \cdot \color{blue}{\frac{\frac{1}{-2}}{y}}\right) \cdot z \]
      14. metadata-eval55.9%

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

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

    if 5.0000000000000002e-154 < (*.f64 x x) < 4.99999999999999999e-79 or 0.0200000000000000004 < (*.f64 x x) < 1.00000000000000001e155

    1. Initial program 70.4%

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

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

    if 4.99999999999999999e-79 < (*.f64 x x) < 0.0200000000000000004

    1. Initial program 64.7%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot {z}^{2}}{y}} \]
      2. unpow251.4%

        \[\leadsto \frac{-0.5 \cdot \color{blue}{\left(z \cdot z\right)}}{y} \]
      3. associate-*r*51.4%

        \[\leadsto \frac{\color{blue}{\left(-0.5 \cdot z\right) \cdot z}}{y} \]
      4. *-commutative51.4%

        \[\leadsto \frac{\color{blue}{\left(z \cdot -0.5\right)} \cdot z}{y} \]
      5. metadata-eval51.4%

        \[\leadsto \frac{\left(z \cdot \color{blue}{\left(-0.5\right)}\right) \cdot z}{y} \]
      6. distribute-rgt-neg-in51.4%

        \[\leadsto \frac{\color{blue}{\left(-z \cdot 0.5\right)} \cdot z}{y} \]
      7. associate-*r/57.0%

        \[\leadsto \color{blue}{\left(-z \cdot 0.5\right) \cdot \frac{z}{y}} \]
      8. distribute-rgt-neg-in57.0%

        \[\leadsto \color{blue}{\left(z \cdot \left(-0.5\right)\right)} \cdot \frac{z}{y} \]
      9. metadata-eval57.0%

        \[\leadsto \left(z \cdot \color{blue}{-0.5}\right) \cdot \frac{z}{y} \]
      10. associate-*l*57.0%

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

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

    if 1.00000000000000001e155 < (*.f64 x x)

    1. Initial program 65.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{y \cdot 2}{x}}} \]
      2. associate-/r/69.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-154}:\\ \;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-79}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;x \cdot x \leq 0.02:\\ \;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\ \mathbf{elif}\;x \cdot x \leq 10^{+155}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{x}{y \cdot 2}\\ \end{array} \]

Alternative 3: 53.0% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-79}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;x \cdot x \leq 0.02:\\
\;\;\;\;\frac{\frac{z}{y}}{\frac{-2}{z}}\\

\mathbf{elif}\;x \cdot x \leq 10^{+155}:\\
\;\;\;\;0.5 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x x) < 5.0000000000000002e-154

    1. Initial program 68.9%

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

      \[\leadsto \frac{\color{blue}{-1 \cdot {z}^{2}}}{y \cdot 2} \]
    3. Step-by-step derivation
      1. mul-1-neg48.9%

        \[\leadsto \frac{\color{blue}{-{z}^{2}}}{y \cdot 2} \]
      2. unpow248.9%

        \[\leadsto \frac{-\color{blue}{z \cdot z}}{y \cdot 2} \]
      3. distribute-rgt-neg-in48.9%

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

      \[\leadsto \frac{\color{blue}{z \cdot \left(-z\right)}}{y \cdot 2} \]
    5. Step-by-step derivation
      1. times-frac55.9%

        \[\leadsto \color{blue}{\frac{z}{y} \cdot \frac{-z}{2}} \]
      2. metadata-eval55.9%

        \[\leadsto \frac{z}{y} \cdot \frac{-z}{\color{blue}{--2}} \]
      3. frac-2neg55.9%

        \[\leadsto \frac{z}{y} \cdot \color{blue}{\frac{z}{-2}} \]
      4. div-inv55.9%

        \[\leadsto \frac{z}{y} \cdot \color{blue}{\left(z \cdot \frac{1}{-2}\right)} \]
      5. metadata-eval55.9%

        \[\leadsto \frac{z}{y} \cdot \left(z \cdot \color{blue}{-0.5}\right) \]
      6. *-commutative55.9%

        \[\leadsto \frac{z}{y} \cdot \color{blue}{\left(-0.5 \cdot z\right)} \]
      7. associate-*r*55.9%

        \[\leadsto \color{blue}{\left(\frac{z}{y} \cdot -0.5\right) \cdot z} \]
      8. div-inv55.9%

        \[\leadsto \left(\color{blue}{\left(z \cdot \frac{1}{y}\right)} \cdot -0.5\right) \cdot z \]
      9. associate-*l*55.9%

        \[\leadsto \color{blue}{\left(z \cdot \left(\frac{1}{y} \cdot -0.5\right)\right)} \cdot z \]
      10. metadata-eval55.9%

        \[\leadsto \left(z \cdot \left(\frac{1}{y} \cdot \color{blue}{\frac{1}{-2}}\right)\right) \cdot z \]
      11. div-inv55.9%

        \[\leadsto \left(z \cdot \color{blue}{\frac{\frac{1}{y}}{-2}}\right) \cdot z \]
      12. associate-/l/55.9%

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

        \[\leadsto \left(z \cdot \color{blue}{\frac{\frac{1}{-2}}{y}}\right) \cdot z \]
      14. metadata-eval55.9%

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

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

    if 5.0000000000000002e-154 < (*.f64 x x) < 4.99999999999999999e-79 or 0.0200000000000000004 < (*.f64 x x) < 1.00000000000000001e155

    1. Initial program 70.4%

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

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

    if 4.99999999999999999e-79 < (*.f64 x x) < 0.0200000000000000004

    1. Initial program 64.7%

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

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

        \[\leadsto \color{blue}{\frac{{z}^{2}}{y} \cdot -0.5} \]
      2. unpow251.4%

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

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{z}}} \cdot -0.5 \]
    4. Simplified56.9%

      \[\leadsto \color{blue}{\frac{z}{\frac{y}{z}} \cdot -0.5} \]
    5. Step-by-step derivation
      1. associate-/r/57.0%

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

        \[\leadsto \color{blue}{\frac{z}{y} \cdot \left(z \cdot -0.5\right)} \]
      3. metadata-eval57.0%

        \[\leadsto \frac{z}{y} \cdot \left(z \cdot \color{blue}{\frac{1}{-2}}\right) \]
      4. div-inv57.0%

        \[\leadsto \frac{z}{y} \cdot \color{blue}{\frac{z}{-2}} \]
      5. frac-2neg57.0%

        \[\leadsto \frac{z}{y} \cdot \color{blue}{\frac{-z}{--2}} \]
      6. metadata-eval57.0%

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

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

        \[\leadsto \color{blue}{\frac{\frac{z}{y}}{\frac{2}{-z}}} \]
      9. metadata-eval57.1%

        \[\leadsto \frac{\frac{z}{y}}{\frac{\color{blue}{--2}}{-z}} \]
      10. frac-2neg57.1%

        \[\leadsto \frac{\frac{z}{y}}{\color{blue}{\frac{-2}{z}}} \]
    6. Applied egg-rr57.1%

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

    if 1.00000000000000001e155 < (*.f64 x x)

    1. Initial program 65.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{y \cdot 2}{x}}} \]
      2. associate-/r/69.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-154}:\\ \;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-79}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;x \cdot x \leq 0.02:\\ \;\;\;\;\frac{\frac{z}{y}}{\frac{-2}{z}}\\ \mathbf{elif}\;x \cdot x \leq 10^{+155}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{x}{y \cdot 2}\\ \end{array} \]

Alternative 4: 84.7% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+307}:\\
\;\;\;\;\frac{0.5}{y} \cdot \left(x \cdot x - z \cdot z\right)\\

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


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

    1. Initial program 73.8%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(\frac{x \cdot x}{y} + \left(y - \frac{z}{\frac{y}{z}}\right)\right)} \]
    5. Taylor expanded in x around 0 89.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+89.7%

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000001e-9 < (*.f64 z z) < 1.99999999999999997e307

    1. Initial program 83.4%

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

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

        \[\leadsto \frac{\color{blue}{x \cdot x} - {z}^{2}}{y \cdot 2} \]
      2. unpow278.8%

        \[\leadsto \frac{x \cdot x - \color{blue}{z \cdot z}}{y \cdot 2} \]
    4. Simplified78.8%

      \[\leadsto \frac{\color{blue}{x \cdot x - z \cdot z}}{y \cdot 2} \]
    5. Step-by-step derivation
      1. div-inv78.9%

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

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

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

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

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

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

    if 1.99999999999999997e307 < (*.f64 z z)

    1. Initial program 43.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(y - \color{blue}{z \cdot \frac{z}{y}}\right) \]
    7. Simplified89.0%

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

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

Alternative 5: 85.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 73.8%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(\frac{x \cdot x}{y} + \left(y - \frac{z}{\frac{y}{z}}\right)\right)} \]
    5. Taylor expanded in x around 0 89.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+89.7%

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000001e-9 < (*.f64 z z)

    1. Initial program 61.2%

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

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

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

        \[\leadsto \frac{x \cdot x - \color{blue}{z \cdot z}}{y \cdot 2} \]
    4. Simplified64.1%

      \[\leadsto \frac{\color{blue}{x \cdot x - z \cdot z}}{y \cdot 2} \]
    5. Step-by-step derivation
      1. add-exp-log_binary6432.3%

        \[\leadsto \color{blue}{e^{\log \left(\frac{x \cdot x - z \cdot z}{y \cdot 2}\right)}} \]
    6. Applied rewrite-once32.3%

      \[\leadsto \color{blue}{e^{\log \left(\frac{x \cdot x - z \cdot z}{y \cdot 2}\right)}} \]
    7. Step-by-step derivation
      1. rem-exp-log64.1%

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

        \[\leadsto \color{blue}{\frac{\frac{x \cdot x - z \cdot z}{y}}{2}} \]
      3. difference-of-squares76.6%

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

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

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

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

Alternative 6: 80.2% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 2.00000000000000004e234

    1. Initial program 74.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000004e234 < (*.f64 z z)

    1. Initial program 54.3%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot {z}^{2}}{y}} \]
      2. unpow263.7%

        \[\leadsto \frac{-0.5 \cdot \color{blue}{\left(z \cdot z\right)}}{y} \]
      3. associate-*r*63.7%

        \[\leadsto \frac{\color{blue}{\left(-0.5 \cdot z\right) \cdot z}}{y} \]
      4. *-commutative63.7%

        \[\leadsto \frac{\color{blue}{\left(z \cdot -0.5\right)} \cdot z}{y} \]
      5. metadata-eval63.7%

        \[\leadsto \frac{\left(z \cdot \color{blue}{\left(-0.5\right)}\right) \cdot z}{y} \]
      6. distribute-rgt-neg-in63.7%

        \[\leadsto \frac{\color{blue}{\left(-z \cdot 0.5\right)} \cdot z}{y} \]
      7. associate-*r/71.7%

        \[\leadsto \color{blue}{\left(-z \cdot 0.5\right) \cdot \frac{z}{y}} \]
      8. distribute-rgt-neg-in71.7%

        \[\leadsto \color{blue}{\left(z \cdot \left(-0.5\right)\right)} \cdot \frac{z}{y} \]
      9. metadata-eval71.7%

        \[\leadsto \left(z \cdot \color{blue}{-0.5}\right) \cdot \frac{z}{y} \]
      10. associate-*l*71.7%

        \[\leadsto \color{blue}{z \cdot \left(-0.5 \cdot \frac{z}{y}\right)} \]
    4. Simplified71.7%

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

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

Alternative 7: 52.7% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+180}:\\
\;\;\;\;0.5 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 4e180

    1. Initial program 74.1%

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

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

    if 4e180 < (*.f64 z z)

    1. Initial program 57.4%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot {z}^{2}}{y}} \]
      2. unpow261.8%

        \[\leadsto \frac{-0.5 \cdot \color{blue}{\left(z \cdot z\right)}}{y} \]
      3. associate-*r*61.8%

        \[\leadsto \frac{\color{blue}{\left(-0.5 \cdot z\right) \cdot z}}{y} \]
      4. *-commutative61.8%

        \[\leadsto \frac{\color{blue}{\left(z \cdot -0.5\right)} \cdot z}{y} \]
      5. metadata-eval61.8%

        \[\leadsto \frac{\left(z \cdot \color{blue}{\left(-0.5\right)}\right) \cdot z}{y} \]
      6. distribute-rgt-neg-in61.8%

        \[\leadsto \frac{\color{blue}{\left(-z \cdot 0.5\right)} \cdot z}{y} \]
      7. associate-*r/68.9%

        \[\leadsto \color{blue}{\left(-z \cdot 0.5\right) \cdot \frac{z}{y}} \]
      8. distribute-rgt-neg-in68.9%

        \[\leadsto \color{blue}{\left(z \cdot \left(-0.5\right)\right)} \cdot \frac{z}{y} \]
      9. metadata-eval68.9%

        \[\leadsto \left(z \cdot \color{blue}{-0.5}\right) \cdot \frac{z}{y} \]
      10. associate-*l*68.9%

        \[\leadsto \color{blue}{z \cdot \left(-0.5 \cdot \frac{z}{y}\right)} \]
    4. Simplified68.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+180}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\ \end{array} \]

Alternative 8: 72.8% accurate, 1.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.2999999999999999e120

    1. Initial program 70.4%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(\frac{x \cdot x}{y} + \left(y - \frac{z}{\frac{y}{z}}\right)\right)} \]
    5. Taylor expanded in x around 0 80.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+80.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{x}{\frac{y}{x}}}\right) \]
    10. Simplified73.0%

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

    if 1.2999999999999999e120 < z

    1. Initial program 54.7%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot {z}^{2}}{y}} \]
      2. unpow261.9%

        \[\leadsto \frac{-0.5 \cdot \color{blue}{\left(z \cdot z\right)}}{y} \]
      3. associate-*r*61.9%

        \[\leadsto \frac{\color{blue}{\left(-0.5 \cdot z\right) \cdot z}}{y} \]
      4. *-commutative61.9%

        \[\leadsto \frac{\color{blue}{\left(z \cdot -0.5\right)} \cdot z}{y} \]
      5. metadata-eval61.9%

        \[\leadsto \frac{\left(z \cdot \color{blue}{\left(-0.5\right)}\right) \cdot z}{y} \]
      6. distribute-rgt-neg-in61.9%

        \[\leadsto \frac{\color{blue}{\left(-z \cdot 0.5\right)} \cdot z}{y} \]
      7. associate-*r/71.3%

        \[\leadsto \color{blue}{\left(-z \cdot 0.5\right) \cdot \frac{z}{y}} \]
      8. distribute-rgt-neg-in71.3%

        \[\leadsto \color{blue}{\left(z \cdot \left(-0.5\right)\right)} \cdot \frac{z}{y} \]
      9. metadata-eval71.3%

        \[\leadsto \left(z \cdot \color{blue}{-0.5}\right) \cdot \frac{z}{y} \]
      10. associate-*l*71.3%

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

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

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

Alternative 9: 75.2% accurate, 1.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.06e86

    1. Initial program 70.4%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(\frac{x \cdot x}{y} + \left(y - \frac{z}{\frac{y}{z}}\right)\right)} \]
    5. Taylor expanded in x around 0 80.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+80.3%

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

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

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

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

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

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

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

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

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

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

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

    if 1.06e86 < z

    1. Initial program 56.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 39.6% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 10^{+304}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z) :precision binary64 (if (<= (* x x) 1e+304) (* 0.5 y) (* x x)))
double code(double x, double y, double z) {
	double tmp;
	if ((x * x) <= 1e+304) {
		tmp = 0.5 * y;
	} else {
		tmp = x * x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((x * x) <= 1d+304) then
        tmp = 0.5d0 * y
    else
        tmp = x * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x * x) <= 1e+304) {
		tmp = 0.5 * y;
	} else {
		tmp = x * x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x * x) <= 1e+304:
		tmp = 0.5 * y
	else:
		tmp = x * x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (Float64(x * x) <= 1e+304)
		tmp = Float64(0.5 * y);
	else
		tmp = Float64(x * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x * x) <= 1e+304)
		tmp = 0.5 * y;
	else
		tmp = x * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 1e+304], N[(0.5 * y), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;x \cdot x\\


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

    1. Initial program 70.7%

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

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

    if 9.9999999999999994e303 < (*.f64 x x)

    1. Initial program 59.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{y \cdot 2}{x}}} \]
      2. associate-/r/75.9%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, 0\right)} \]
    8. Step-by-step derivation
      1. fma-udef47.3%

        \[\leadsto \color{blue}{x \cdot x + 0} \]
      2. +-rgt-identity47.3%

        \[\leadsto \color{blue}{x \cdot x} \]
    9. Simplified47.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 10^{+304}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 11: 33.1% accurate, 5.0× speedup?

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

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

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

    \[\leadsto \color{blue}{0.5 \cdot y} \]
  3. Final simplification30.5%

    \[\leadsto 0.5 \cdot y \]

Alternative 12: 2.9% accurate, 15.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
	return x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x
end function
public static double code(double x, double y, double z) {
	return x;
}
def code(x, y, z):
	return x
function code(x, y, z)
	return x
end
function tmp = code(x, y, z)
	tmp = x;
end
code[x_, y_, z_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 67.5%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{y \cdot 2}{x}}} \]
    2. associate-/r/36.1%

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

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

    \[\leadsto \color{blue}{0 + x} \]
  8. Step-by-step derivation
    1. +-lft-identity2.8%

      \[\leadsto \color{blue}{x} \]
  9. Simplified2.8%

    \[\leadsto \color{blue}{x} \]
  10. Final simplification2.8%

    \[\leadsto x \]

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

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

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