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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
    10. div-sub73.5%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 52.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ t_1 := z \cdot \left(-0.5 \cdot \frac{z}{y}\right)\\ \mathbf{if}\;y \leq -1.85 \cdot 10^{-39}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{-175}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-89}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-15}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+53}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 8 \cdot 10^{+82}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* x (/ 0.5 y)))) (t_1 (* z (* -0.5 (/ z y)))))
   (if (<= y -1.85e-39)
     (* y 0.5)
     (if (<= y -2.8e-175)
       t_1
       (if (<= y 2.2e-89)
         t_0
         (if (<= y 1.4e-15)
           t_1
           (if (<= y 5e+53) (* y 0.5) (if (<= y 8e+82) t_0 (* y 0.5)))))))))
double code(double x, double y, double z) {
	double t_0 = x * (x * (0.5 / y));
	double t_1 = z * (-0.5 * (z / y));
	double tmp;
	if (y <= -1.85e-39) {
		tmp = y * 0.5;
	} else if (y <= -2.8e-175) {
		tmp = t_1;
	} else if (y <= 2.2e-89) {
		tmp = t_0;
	} else if (y <= 1.4e-15) {
		tmp = t_1;
	} else if (y <= 5e+53) {
		tmp = y * 0.5;
	} else if (y <= 8e+82) {
		tmp = t_0;
	} else {
		tmp = 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * (x * (0.5d0 / y))
    t_1 = z * ((-0.5d0) * (z / y))
    if (y <= (-1.85d-39)) then
        tmp = y * 0.5d0
    else if (y <= (-2.8d-175)) then
        tmp = t_1
    else if (y <= 2.2d-89) then
        tmp = t_0
    else if (y <= 1.4d-15) then
        tmp = t_1
    else if (y <= 5d+53) then
        tmp = y * 0.5d0
    else if (y <= 8d+82) then
        tmp = t_0
    else
        tmp = y * 0.5d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (x * (0.5 / y));
	double t_1 = z * (-0.5 * (z / y));
	double tmp;
	if (y <= -1.85e-39) {
		tmp = y * 0.5;
	} else if (y <= -2.8e-175) {
		tmp = t_1;
	} else if (y <= 2.2e-89) {
		tmp = t_0;
	} else if (y <= 1.4e-15) {
		tmp = t_1;
	} else if (y <= 5e+53) {
		tmp = y * 0.5;
	} else if (y <= 8e+82) {
		tmp = t_0;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (x * (0.5 / y))
	t_1 = z * (-0.5 * (z / y))
	tmp = 0
	if y <= -1.85e-39:
		tmp = y * 0.5
	elif y <= -2.8e-175:
		tmp = t_1
	elif y <= 2.2e-89:
		tmp = t_0
	elif y <= 1.4e-15:
		tmp = t_1
	elif y <= 5e+53:
		tmp = y * 0.5
	elif y <= 8e+82:
		tmp = t_0
	else:
		tmp = y * 0.5
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(x * Float64(0.5 / y)))
	t_1 = Float64(z * Float64(-0.5 * Float64(z / y)))
	tmp = 0.0
	if (y <= -1.85e-39)
		tmp = Float64(y * 0.5);
	elseif (y <= -2.8e-175)
		tmp = t_1;
	elseif (y <= 2.2e-89)
		tmp = t_0;
	elseif (y <= 1.4e-15)
		tmp = t_1;
	elseif (y <= 5e+53)
		tmp = Float64(y * 0.5);
	elseif (y <= 8e+82)
		tmp = t_0;
	else
		tmp = Float64(y * 0.5);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (x * (0.5 / y));
	t_1 = z * (-0.5 * (z / y));
	tmp = 0.0;
	if (y <= -1.85e-39)
		tmp = y * 0.5;
	elseif (y <= -2.8e-175)
		tmp = t_1;
	elseif (y <= 2.2e-89)
		tmp = t_0;
	elseif (y <= 1.4e-15)
		tmp = t_1;
	elseif (y <= 5e+53)
		tmp = y * 0.5;
	elseif (y <= 8e+82)
		tmp = t_0;
	else
		tmp = y * 0.5;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(-0.5 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.85e-39], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, -2.8e-175], t$95$1, If[LessEqual[y, 2.2e-89], t$95$0, If[LessEqual[y, 1.4e-15], t$95$1, If[LessEqual[y, 5e+53], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, 8e+82], t$95$0, N[(y * 0.5), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
t_1 := z \cdot \left(-0.5 \cdot \frac{z}{y}\right)\\
\mathbf{if}\;y \leq -1.85 \cdot 10^{-39}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;y \leq -2.8 \cdot 10^{-175}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 2.2 \cdot 10^{-89}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 1.4 \cdot 10^{-15}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 5 \cdot 10^{+53}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;y \leq 8 \cdot 10^{+82}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.85000000000000007e-39 or 1.40000000000000007e-15 < y < 5.0000000000000004e53 or 7.9999999999999997e82 < y

    1. Initial program 57.8%

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

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    3. Step-by-step derivation
      1. *-commutative67.6%

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    4. Simplified67.6%

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

    if -1.85000000000000007e-39 < y < -2.8e-175 or 2.20000000000000012e-89 < y < 1.40000000000000007e-15

    1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{{z}^{2}}{y}} \]
    9. Step-by-step derivation
      1. unpow265.0%

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

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

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

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

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

    if -2.8e-175 < y < 2.20000000000000012e-89 or 5.0000000000000004e53 < y < 7.9999999999999997e82

    1. Initial program 89.7%

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

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

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

      \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 2} \]
    5. Taylor expanded in x around 0 62.0%

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

        \[\leadsto \color{blue}{\frac{{x}^{2}}{y} \cdot 0.5} \]
      2. unpow262.0%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{y} \cdot 0.5 \]
      3. metadata-eval62.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.85 \cdot 10^{-39}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{-175}:\\ \;\;\;\;z \cdot \left(-0.5 \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-89}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-15}:\\ \;\;\;\;z \cdot \left(-0.5 \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+53}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 8 \cdot 10^{+82}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]

Alternative 3: 52.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{y} \cdot \left(x \cdot 0.5\right)\\ t_1 := z \cdot \left(-0.5 \cdot \frac{z}{y}\right)\\ \mathbf{if}\;y \leq -8.5 \cdot 10^{-36}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq -1.02 \cdot 10^{-173}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{-87}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-17}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{+54}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{+82}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (/ x y) (* x 0.5))) (t_1 (* z (* -0.5 (/ z y)))))
   (if (<= y -8.5e-36)
     (* y 0.5)
     (if (<= y -1.02e-173)
       t_1
       (if (<= y 7.6e-87)
         t_0
         (if (<= y 3.6e-17)
           t_1
           (if (<= y 5.8e+54)
             (* y 0.5)
             (if (<= y 8.2e+82) t_0 (* y 0.5)))))))))
double code(double x, double y, double z) {
	double t_0 = (x / y) * (x * 0.5);
	double t_1 = z * (-0.5 * (z / y));
	double tmp;
	if (y <= -8.5e-36) {
		tmp = y * 0.5;
	} else if (y <= -1.02e-173) {
		tmp = t_1;
	} else if (y <= 7.6e-87) {
		tmp = t_0;
	} else if (y <= 3.6e-17) {
		tmp = t_1;
	} else if (y <= 5.8e+54) {
		tmp = y * 0.5;
	} else if (y <= 8.2e+82) {
		tmp = t_0;
	} else {
		tmp = 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (x / y) * (x * 0.5d0)
    t_1 = z * ((-0.5d0) * (z / y))
    if (y <= (-8.5d-36)) then
        tmp = y * 0.5d0
    else if (y <= (-1.02d-173)) then
        tmp = t_1
    else if (y <= 7.6d-87) then
        tmp = t_0
    else if (y <= 3.6d-17) then
        tmp = t_1
    else if (y <= 5.8d+54) then
        tmp = y * 0.5d0
    else if (y <= 8.2d+82) then
        tmp = t_0
    else
        tmp = y * 0.5d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x / y) * (x * 0.5);
	double t_1 = z * (-0.5 * (z / y));
	double tmp;
	if (y <= -8.5e-36) {
		tmp = y * 0.5;
	} else if (y <= -1.02e-173) {
		tmp = t_1;
	} else if (y <= 7.6e-87) {
		tmp = t_0;
	} else if (y <= 3.6e-17) {
		tmp = t_1;
	} else if (y <= 5.8e+54) {
		tmp = y * 0.5;
	} else if (y <= 8.2e+82) {
		tmp = t_0;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x / y) * (x * 0.5)
	t_1 = z * (-0.5 * (z / y))
	tmp = 0
	if y <= -8.5e-36:
		tmp = y * 0.5
	elif y <= -1.02e-173:
		tmp = t_1
	elif y <= 7.6e-87:
		tmp = t_0
	elif y <= 3.6e-17:
		tmp = t_1
	elif y <= 5.8e+54:
		tmp = y * 0.5
	elif y <= 8.2e+82:
		tmp = t_0
	else:
		tmp = y * 0.5
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x / y) * Float64(x * 0.5))
	t_1 = Float64(z * Float64(-0.5 * Float64(z / y)))
	tmp = 0.0
	if (y <= -8.5e-36)
		tmp = Float64(y * 0.5);
	elseif (y <= -1.02e-173)
		tmp = t_1;
	elseif (y <= 7.6e-87)
		tmp = t_0;
	elseif (y <= 3.6e-17)
		tmp = t_1;
	elseif (y <= 5.8e+54)
		tmp = Float64(y * 0.5);
	elseif (y <= 8.2e+82)
		tmp = t_0;
	else
		tmp = Float64(y * 0.5);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x / y) * (x * 0.5);
	t_1 = z * (-0.5 * (z / y));
	tmp = 0.0;
	if (y <= -8.5e-36)
		tmp = y * 0.5;
	elseif (y <= -1.02e-173)
		tmp = t_1;
	elseif (y <= 7.6e-87)
		tmp = t_0;
	elseif (y <= 3.6e-17)
		tmp = t_1;
	elseif (y <= 5.8e+54)
		tmp = y * 0.5;
	elseif (y <= 8.2e+82)
		tmp = t_0;
	else
		tmp = y * 0.5;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / y), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(-0.5 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.5e-36], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, -1.02e-173], t$95$1, If[LessEqual[y, 7.6e-87], t$95$0, If[LessEqual[y, 3.6e-17], t$95$1, If[LessEqual[y, 5.8e+54], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, 8.2e+82], t$95$0, N[(y * 0.5), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x}{y} \cdot \left(x \cdot 0.5\right)\\
t_1 := z \cdot \left(-0.5 \cdot \frac{z}{y}\right)\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{-36}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;y \leq -1.02 \cdot 10^{-173}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 7.6 \cdot 10^{-87}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 3.6 \cdot 10^{-17}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 5.8 \cdot 10^{+54}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;y \leq 8.2 \cdot 10^{+82}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -8.5000000000000007e-36 or 3.59999999999999995e-17 < y < 5.7999999999999997e54 or 8.1999999999999999e82 < y

    1. Initial program 57.8%

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

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    3. Step-by-step derivation
      1. *-commutative67.6%

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    4. Simplified67.6%

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

    if -8.5000000000000007e-36 < y < -1.02000000000000006e-173 or 7.6e-87 < y < 3.59999999999999995e-17

    1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{{z}^{2}}{y}} \]
    9. Step-by-step derivation
      1. unpow265.0%

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

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

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

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

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

    if -1.02000000000000006e-173 < y < 7.6e-87 or 5.7999999999999997e54 < y < 8.1999999999999999e82

    1. Initial program 89.7%

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

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

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

      \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 2} \]
    5. Step-by-step derivation
      1. times-frac65.2%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
      2. div-inv65.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{-36}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq -1.02 \cdot 10^{-173}:\\ \;\;\;\;z \cdot \left(-0.5 \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{-87}:\\ \;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-17}:\\ \;\;\;\;z \cdot \left(-0.5 \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{+54}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{+82}:\\ \;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]

Alternative 4: 52.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{y} \cdot \left(x \cdot 0.5\right)\\ \mathbf{if}\;y \leq -8.5 \cdot 10^{-36}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq -1.02 \cdot 10^{-174}:\\ \;\;\;\;-0.5 \cdot \frac{z \cdot z}{y}\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{-91}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-15}:\\ \;\;\;\;z \cdot \left(-0.5 \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{+54}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{+82}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (/ x y) (* x 0.5))))
   (if (<= y -8.5e-36)
     (* y 0.5)
     (if (<= y -1.02e-174)
       (* -0.5 (/ (* z z) y))
       (if (<= y 1.15e-91)
         t_0
         (if (<= y 2.1e-15)
           (* z (* -0.5 (/ z y)))
           (if (<= y 8.6e+54)
             (* y 0.5)
             (if (<= y 8.6e+82) t_0 (* y 0.5)))))))))
double code(double x, double y, double z) {
	double t_0 = (x / y) * (x * 0.5);
	double tmp;
	if (y <= -8.5e-36) {
		tmp = y * 0.5;
	} else if (y <= -1.02e-174) {
		tmp = -0.5 * ((z * z) / y);
	} else if (y <= 1.15e-91) {
		tmp = t_0;
	} else if (y <= 2.1e-15) {
		tmp = z * (-0.5 * (z / y));
	} else if (y <= 8.6e+54) {
		tmp = y * 0.5;
	} else if (y <= 8.6e+82) {
		tmp = t_0;
	} else {
		tmp = 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) :: t_0
    real(8) :: tmp
    t_0 = (x / y) * (x * 0.5d0)
    if (y <= (-8.5d-36)) then
        tmp = y * 0.5d0
    else if (y <= (-1.02d-174)) then
        tmp = (-0.5d0) * ((z * z) / y)
    else if (y <= 1.15d-91) then
        tmp = t_0
    else if (y <= 2.1d-15) then
        tmp = z * ((-0.5d0) * (z / y))
    else if (y <= 8.6d+54) then
        tmp = y * 0.5d0
    else if (y <= 8.6d+82) then
        tmp = t_0
    else
        tmp = y * 0.5d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x / y) * (x * 0.5);
	double tmp;
	if (y <= -8.5e-36) {
		tmp = y * 0.5;
	} else if (y <= -1.02e-174) {
		tmp = -0.5 * ((z * z) / y);
	} else if (y <= 1.15e-91) {
		tmp = t_0;
	} else if (y <= 2.1e-15) {
		tmp = z * (-0.5 * (z / y));
	} else if (y <= 8.6e+54) {
		tmp = y * 0.5;
	} else if (y <= 8.6e+82) {
		tmp = t_0;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x / y) * (x * 0.5)
	tmp = 0
	if y <= -8.5e-36:
		tmp = y * 0.5
	elif y <= -1.02e-174:
		tmp = -0.5 * ((z * z) / y)
	elif y <= 1.15e-91:
		tmp = t_0
	elif y <= 2.1e-15:
		tmp = z * (-0.5 * (z / y))
	elif y <= 8.6e+54:
		tmp = y * 0.5
	elif y <= 8.6e+82:
		tmp = t_0
	else:
		tmp = y * 0.5
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x / y) * Float64(x * 0.5))
	tmp = 0.0
	if (y <= -8.5e-36)
		tmp = Float64(y * 0.5);
	elseif (y <= -1.02e-174)
		tmp = Float64(-0.5 * Float64(Float64(z * z) / y));
	elseif (y <= 1.15e-91)
		tmp = t_0;
	elseif (y <= 2.1e-15)
		tmp = Float64(z * Float64(-0.5 * Float64(z / y)));
	elseif (y <= 8.6e+54)
		tmp = Float64(y * 0.5);
	elseif (y <= 8.6e+82)
		tmp = t_0;
	else
		tmp = Float64(y * 0.5);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x / y) * (x * 0.5);
	tmp = 0.0;
	if (y <= -8.5e-36)
		tmp = y * 0.5;
	elseif (y <= -1.02e-174)
		tmp = -0.5 * ((z * z) / y);
	elseif (y <= 1.15e-91)
		tmp = t_0;
	elseif (y <= 2.1e-15)
		tmp = z * (-0.5 * (z / y));
	elseif (y <= 8.6e+54)
		tmp = y * 0.5;
	elseif (y <= 8.6e+82)
		tmp = t_0;
	else
		tmp = y * 0.5;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / y), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.5e-36], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, -1.02e-174], N[(-0.5 * N[(N[(z * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e-91], t$95$0, If[LessEqual[y, 2.1e-15], N[(z * N[(-0.5 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.6e+54], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, 8.6e+82], t$95$0, N[(y * 0.5), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x}{y} \cdot \left(x \cdot 0.5\right)\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{-36}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;y \leq -1.02 \cdot 10^{-174}:\\
\;\;\;\;-0.5 \cdot \frac{z \cdot z}{y}\\

\mathbf{elif}\;y \leq 1.15 \cdot 10^{-91}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 2.1 \cdot 10^{-15}:\\
\;\;\;\;z \cdot \left(-0.5 \cdot \frac{z}{y}\right)\\

\mathbf{elif}\;y \leq 8.6 \cdot 10^{+54}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;y \leq 8.6 \cdot 10^{+82}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -8.5000000000000007e-36 or 2.09999999999999981e-15 < y < 8.59999999999999952e54 or 8.60000000000000029e82 < y

    1. Initial program 57.8%

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

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    3. Step-by-step derivation
      1. *-commutative67.6%

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    4. Simplified67.6%

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

    if -8.5000000000000007e-36 < y < -1.02000000000000011e-174

    1. Initial program 99.9%

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

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

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

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

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

    if -1.02000000000000011e-174 < y < 1.14999999999999998e-91 or 8.59999999999999952e54 < y < 8.60000000000000029e82

    1. Initial program 89.7%

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

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

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

      \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 2} \]
    5. Step-by-step derivation
      1. times-frac65.2%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
      2. div-inv65.2%

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

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

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

    if 1.14999999999999998e-91 < y < 2.09999999999999981e-15

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{{z}^{2}}{y}} \]
    9. Step-by-step derivation
      1. unpow274.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{-36}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq -1.02 \cdot 10^{-174}:\\ \;\;\;\;-0.5 \cdot \frac{z \cdot z}{y}\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{-91}:\\ \;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-15}:\\ \;\;\;\;z \cdot \left(-0.5 \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{+54}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{+82}:\\ \;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]

Alternative 5: 89.0% accurate, 1.0× speedup?

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

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

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


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

    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. sub-neg73.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999928e-35 < (*.f64 x x)

    1. Initial program 74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 43.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.0033 \lor \neg \left(x \leq 3 \cdot 10^{+29}\right) \land x \leq 9 \cdot 10^{+117}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x 0.0033) (and (not (<= x 3e+29)) (<= x 9e+117)))
   (* y 0.5)
   (* x (* x (/ 0.5 y)))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= 0.0033) || (!(x <= 3e+29) && (x <= 9e+117))) {
		tmp = y * 0.5;
	} else {
		tmp = x * (x * (0.5 / 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 ((x <= 0.0033d0) .or. (.not. (x <= 3d+29)) .and. (x <= 9d+117)) then
        tmp = y * 0.5d0
    else
        tmp = x * (x * (0.5d0 / y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= 0.0033) || (!(x <= 3e+29) && (x <= 9e+117))) {
		tmp = y * 0.5;
	} else {
		tmp = x * (x * (0.5 / y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= 0.0033) or (not (x <= 3e+29) and (x <= 9e+117)):
		tmp = y * 0.5
	else:
		tmp = x * (x * (0.5 / y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= 0.0033) || (!(x <= 3e+29) && (x <= 9e+117)))
		tmp = Float64(y * 0.5);
	else
		tmp = Float64(x * Float64(x * Float64(0.5 / y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= 0.0033) || (~((x <= 3e+29)) && (x <= 9e+117)))
		tmp = y * 0.5;
	else
		tmp = x * (x * (0.5 / y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, 0.0033], And[N[Not[LessEqual[x, 3e+29]], $MachinePrecision], LessEqual[x, 9e+117]]], N[(y * 0.5), $MachinePrecision], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0033 \lor \neg \left(x \leq 3 \cdot 10^{+29}\right) \land x \leq 9 \cdot 10^{+117}:\\
\;\;\;\;y \cdot 0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.0033 or 2.9999999999999999e29 < x < 9e117

    1. Initial program 73.6%

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

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    3. Step-by-step derivation
      1. *-commutative44.7%

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

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

    if 0.0033 < x < 2.9999999999999999e29 or 9e117 < x

    1. Initial program 73.4%

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

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

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

      \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 2} \]
    5. Taylor expanded in x around 0 67.3%

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

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

        \[\leadsto \frac{\color{blue}{x \cdot x}}{y} \cdot 0.5 \]
      3. metadata-eval67.3%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.0033 \lor \neg \left(x \leq 3 \cdot 10^{+29}\right) \land x \leq 9 \cdot 10^{+117}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \end{array} \]

Alternative 7: 80.5% accurate, 1.1× speedup?

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

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

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


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

    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. sub-neg73.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(x + z\right) \cdot \frac{z - x}{y} - \frac{y}{\color{blue}{1}}\right) \cdot \frac{-1}{2} \]
      16. /-rgt-identity99.8%

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000005e236 < (*.f64 x x)

    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 80.6%

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

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

      \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 2} \]
    5. Step-by-step derivation
      1. times-frac84.5%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
      2. div-inv84.5%

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

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

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

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

Alternative 8: 71.7% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
      10. div-sub74.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\frac{-1 \cdot \left(x \cdot x\right)}{y}} - y\right) \cdot -0.5 \]
      3. neg-mul-176.5%

        \[\leadsto \left(\frac{\color{blue}{-x \cdot x}}{y} - y\right) \cdot -0.5 \]
      4. distribute-rgt-neg-in76.5%

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

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

    if 2.4e-10 < z

    1. Initial program 69.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
      10. div-sub69.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 35.1% accurate, 5.0× speedup?

\[\begin{array}{l} \\ y \cdot 0.5 \end{array} \]
(FPCore (x y z) :precision binary64 (* y 0.5))
double code(double x, double y, double z) {
	return y * 0.5;
}
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
end function
public static double code(double x, double y, double z) {
	return y * 0.5;
}
def code(x, y, z):
	return y * 0.5
function code(x, y, z)
	return Float64(y * 0.5)
end
function tmp = code(x, y, z)
	tmp = y * 0.5;
end
code[x_, y_, z_] := N[(y * 0.5), $MachinePrecision]
\begin{array}{l}

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

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

    \[\leadsto \color{blue}{0.5 \cdot y} \]
  3. Step-by-step derivation
    1. *-commutative40.9%

      \[\leadsto \color{blue}{y \cdot 0.5} \]
  4. Simplified40.9%

    \[\leadsto \color{blue}{y \cdot 0.5} \]
  5. Final simplification40.9%

    \[\leadsto y \cdot 0.5 \]

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 2023224 
(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)))