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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
    10. div-sub69.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-squares74.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. +-commutative74.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-*l/76.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. *-commutative76.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. Step-by-step derivation
    1. clear-num99.9%

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

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

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

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

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

Alternative 2: 83.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-187} \lor \neg \left(x \cdot x \leq 4 \cdot 10^{-129}\right) \land x \cdot x \leq 10^{+46}:\\ \;\;\;\;-0.5 \cdot \left(\frac{z \cdot z}{y} - 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 (or (<= (* x x) 2e-187)
         (and (not (<= (* x x) 4e-129)) (<= (* x x) 1e+46)))
   (* -0.5 (- (/ (* z z) y) y))
   (* -0.5 (- (* (- z x) (/ x y)) y))))
double code(double x, double y, double z) {
	double tmp;
	if (((x * x) <= 2e-187) || (!((x * x) <= 4e-129) && ((x * x) <= 1e+46))) {
		tmp = -0.5 * (((z * z) / y) - 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) <= 2d-187) .or. (.not. ((x * x) <= 4d-129)) .and. ((x * x) <= 1d+46)) then
        tmp = (-0.5d0) * (((z * z) / y) - 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) <= 2e-187) || (!((x * x) <= 4e-129) && ((x * x) <= 1e+46))) {
		tmp = -0.5 * (((z * z) / y) - y);
	} else {
		tmp = -0.5 * (((z - x) * (x / y)) - y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if ((x * x) <= 2e-187) or (not ((x * x) <= 4e-129) and ((x * x) <= 1e+46)):
		tmp = -0.5 * (((z * z) / y) - y)
	else:
		tmp = -0.5 * (((z - x) * (x / y)) - y)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((Float64(x * x) <= 2e-187) || (!(Float64(x * x) <= 4e-129) && (Float64(x * x) <= 1e+46)))
		tmp = Float64(-0.5 * Float64(Float64(Float64(z * z) / y) - 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) <= 2e-187) || (~(((x * x) <= 4e-129)) && ((x * x) <= 1e+46)))
		tmp = -0.5 * (((z * z) / y) - y);
	else
		tmp = -0.5 * (((z - x) * (x / y)) - y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * x), $MachinePrecision], 2e-187], And[N[Not[LessEqual[N[(x * x), $MachinePrecision], 4e-129]], $MachinePrecision], LessEqual[N[(x * x), $MachinePrecision], 1e+46]]], N[(-0.5 * N[(N[(N[(z * z), $MachinePrecision] / y), $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 2 \cdot 10^{-187} \lor \neg \left(x \cdot x \leq 4 \cdot 10^{-129}\right) \land x \cdot x \leq 10^{+46}:\\
\;\;\;\;-0.5 \cdot \left(\frac{z \cdot z}{y} - 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) < 2e-187 or 3.9999999999999997e-129 < (*.f64 x x) < 9.9999999999999999e45

    1. Initial program 75.5%

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

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

        \[\leadsto \frac{\color{blue}{\left(-z \cdot z\right) + \left(x \cdot x + y \cdot y\right)}}{y \cdot 2} \]
      3. neg-sub075.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-75.5%

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z \cdot z - \left(x \cdot x + y \cdot y\right)\right)}}{y \cdot 2} \]
      7. *-commutative75.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-frac75.5%

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

        \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
      10. div-sub75.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.5%

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

        \[\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/77.0%

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

        \[\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 z around inf 94.5%

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

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

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

    if 2e-187 < (*.f64 x x) < 3.9999999999999997e-129 or 9.9999999999999999e45 < (*.f64 x x)

    1. Initial program 64.0%

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

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

        \[\leadsto \frac{\color{blue}{\left(-z \cdot z\right) + \left(x \cdot x + y \cdot y\right)}}{y \cdot 2} \]
      3. neg-sub064.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-64.0%

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z \cdot z - \left(x \cdot x + y \cdot y\right)\right)}}{y \cdot 2} \]
      7. *-commutative64.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-frac64.0%

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

        \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
      10. div-sub64.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-squares74.4%

        \[\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. +-commutative74.4%

        \[\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/76.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-187} \lor \neg \left(x \cdot x \leq 4 \cdot 10^{-129}\right) \land x \cdot x \leq 10^{+46}:\\ \;\;\;\;-0.5 \cdot \left(\frac{z \cdot z}{y} - y\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(\left(z - x\right) \cdot \frac{x}{y} - y\right)\\ \end{array} \]

Alternative 3: 83.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-187} \lor \neg \left(x \cdot x \leq 4 \cdot 10^{-129}\right) \land x \cdot x \leq 10^{+46}:\\
\;\;\;\;-0.5 \cdot \left(\frac{z \cdot z}{y} - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 2e-187 or 3.9999999999999997e-129 < (*.f64 x x) < 9.9999999999999999e45

    1. Initial program 75.5%

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

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

        \[\leadsto \frac{\color{blue}{\left(-z \cdot z\right) + \left(x \cdot x + y \cdot y\right)}}{y \cdot 2} \]
      3. neg-sub075.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-75.5%

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z \cdot z - \left(x \cdot x + y \cdot y\right)\right)}}{y \cdot 2} \]
      7. *-commutative75.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-frac75.5%

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

        \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
      10. div-sub75.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.5%

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

        \[\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/77.0%

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

        \[\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 z around inf 94.5%

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

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

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

    if 2e-187 < (*.f64 x x) < 3.9999999999999997e-129 or 9.9999999999999999e45 < (*.f64 x x)

    1. Initial program 64.0%

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

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

        \[\leadsto \frac{\color{blue}{\left(-z \cdot z\right) + \left(x \cdot x + y \cdot y\right)}}{y \cdot 2} \]
      3. neg-sub064.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-64.0%

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z \cdot z - \left(x \cdot x + y \cdot y\right)\right)}}{y \cdot 2} \]
      7. *-commutative64.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-frac64.0%

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

        \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
      10. div-sub64.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-squares74.4%

        \[\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. +-commutative74.4%

        \[\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/76.0%

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

        \[\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. Step-by-step derivation
      1. clear-num99.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-187} \lor \neg \left(x \cdot x \leq 4 \cdot 10^{-129}\right) \land x \cdot x \leq 10^{+46}:\\ \;\;\;\;-0.5 \cdot \left(\frac{z \cdot z}{y} - y\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(\frac{z - x}{\frac{y}{x}} - y\right)\\ \end{array} \]

Alternative 4: 80.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-187} \lor \neg \left(x \cdot x \leq 4 \cdot 10^{-129}\right) \land x \cdot x \leq 4 \cdot 10^{+55}:\\
\;\;\;\;-0.5 \cdot \left(\frac{z \cdot z}{y} - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 2e-187 or 3.9999999999999997e-129 < (*.f64 x x) < 4.00000000000000004e55

    1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

        \[\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.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. +-commutative75.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-*l/77.1%

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

        \[\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 z around inf 94.5%

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

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

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

    if 2e-187 < (*.f64 x x) < 3.9999999999999997e-129 or 4.00000000000000004e55 < (*.f64 x x)

    1. Initial program 63.8%

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

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

        \[\leadsto \frac{\color{blue}{\left(-z \cdot z\right) + \left(x \cdot x + y \cdot y\right)}}{y \cdot 2} \]
      3. neg-sub063.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-63.8%

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z \cdot z - \left(x \cdot x + y \cdot y\right)\right)}}{y \cdot 2} \]
      7. *-commutative63.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-frac63.8%

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

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

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

        \[\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. +-commutative74.2%

        \[\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/75.8%

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

        \[\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. Step-by-step derivation
      1. clear-num99.9%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-187} \lor \neg \left(x \cdot x \leq 4 \cdot 10^{-129}\right) \land x \cdot x \leq 4 \cdot 10^{+55}:\\ \;\;\;\;-0.5 \cdot \left(\frac{z \cdot z}{y} - y\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(\frac{x}{y} \cdot \left(-x\right) - y\right)\\ \end{array} \]

Alternative 5: 80.2% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-129}:\\
\;\;\;\;-0.5 \cdot \left(\left(-y\right) - \frac{x \cdot x}{y}\right)\\

\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+55}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 2e-187 or 3.9999999999999997e-129 < (*.f64 x x) < 4.00000000000000004e55

    1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

        \[\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.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. +-commutative75.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-*l/77.1%

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

        \[\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 z around inf 94.5%

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

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

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

    if 2e-187 < (*.f64 x x) < 3.9999999999999997e-129

    1. Initial program 74.6%

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

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

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

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

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

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

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

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

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

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

        \[\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-squares74.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. +-commutative74.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-*l/74.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.00000000000000004e55 < (*.f64 x x)

    1. Initial program 61.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
      10. div-sub61.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-squares74.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. +-commutative74.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-*l/75.9%

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

        \[\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. Step-by-step derivation
      1. clear-num99.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 53.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{if}\;y \leq -5.6 \cdot 10^{+42}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 1.08 \cdot 10^{-67}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-22}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{+43}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -0.5 (* z (/ z y)))))
   (if (<= y -5.6e+42)
     (* y 0.5)
     (if (<= y 1.08e-67)
       t_0
       (if (<= y 1.8e-22)
         (* x (* x (/ 0.5 y)))
         (if (<= y 3.4e+43) t_0 (* y 0.5)))))))
double code(double x, double y, double z) {
	double t_0 = -0.5 * (z * (z / y));
	double tmp;
	if (y <= -5.6e+42) {
		tmp = y * 0.5;
	} else if (y <= 1.08e-67) {
		tmp = t_0;
	} else if (y <= 1.8e-22) {
		tmp = x * (x * (0.5 / y));
	} else if (y <= 3.4e+43) {
		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 = (-0.5d0) * (z * (z / y))
    if (y <= (-5.6d+42)) then
        tmp = y * 0.5d0
    else if (y <= 1.08d-67) then
        tmp = t_0
    else if (y <= 1.8d-22) then
        tmp = x * (x * (0.5d0 / y))
    else if (y <= 3.4d+43) 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 = -0.5 * (z * (z / y));
	double tmp;
	if (y <= -5.6e+42) {
		tmp = y * 0.5;
	} else if (y <= 1.08e-67) {
		tmp = t_0;
	} else if (y <= 1.8e-22) {
		tmp = x * (x * (0.5 / y));
	} else if (y <= 3.4e+43) {
		tmp = t_0;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -0.5 * (z * (z / y))
	tmp = 0
	if y <= -5.6e+42:
		tmp = y * 0.5
	elif y <= 1.08e-67:
		tmp = t_0
	elif y <= 1.8e-22:
		tmp = x * (x * (0.5 / y))
	elif y <= 3.4e+43:
		tmp = t_0
	else:
		tmp = y * 0.5
	return tmp
function code(x, y, z)
	t_0 = Float64(-0.5 * Float64(z * Float64(z / y)))
	tmp = 0.0
	if (y <= -5.6e+42)
		tmp = Float64(y * 0.5);
	elseif (y <= 1.08e-67)
		tmp = t_0;
	elseif (y <= 1.8e-22)
		tmp = Float64(x * Float64(x * Float64(0.5 / y)));
	elseif (y <= 3.4e+43)
		tmp = t_0;
	else
		tmp = Float64(y * 0.5);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -0.5 * (z * (z / y));
	tmp = 0.0;
	if (y <= -5.6e+42)
		tmp = y * 0.5;
	elseif (y <= 1.08e-67)
		tmp = t_0;
	elseif (y <= 1.8e-22)
		tmp = x * (x * (0.5 / y));
	elseif (y <= 3.4e+43)
		tmp = t_0;
	else
		tmp = y * 0.5;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-0.5 * N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.6e+42], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, 1.08e-67], t$95$0, If[LessEqual[y, 1.8e-22], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.4e+43], t$95$0, N[(y * 0.5), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.08 \cdot 10^{-67}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 1.8 \cdot 10^{-22}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\

\mathbf{elif}\;y \leq 3.4 \cdot 10^{+43}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.5999999999999999e42 or 3.40000000000000012e43 < y

    1. Initial program 44.2%

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

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

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    4. Simplified74.3%

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

    if -5.5999999999999999e42 < y < 1.0800000000000001e-67 or 1.7999999999999999e-22 < y < 3.40000000000000012e43

    1. Initial program 88.8%

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

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

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

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

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

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

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

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

    if 1.0800000000000001e-67 < y < 1.7999999999999999e-22

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.6 \cdot 10^{+42}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 1.08 \cdot 10^{-67}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-22}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{+43}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]

Alternative 7: 53.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{if}\;y \leq -3.3 \cdot 10^{+42}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{-71}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-22}:\\ \;\;\;\;x \cdot \frac{x}{y \cdot 2}\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+43}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -0.5 (* z (/ z y)))))
   (if (<= y -3.3e+42)
     (* y 0.5)
     (if (<= y 6.8e-71)
       t_0
       (if (<= y 9.5e-22)
         (* x (/ x (* y 2.0)))
         (if (<= y 2.8e+43) t_0 (* y 0.5)))))))
double code(double x, double y, double z) {
	double t_0 = -0.5 * (z * (z / y));
	double tmp;
	if (y <= -3.3e+42) {
		tmp = y * 0.5;
	} else if (y <= 6.8e-71) {
		tmp = t_0;
	} else if (y <= 9.5e-22) {
		tmp = x * (x / (y * 2.0));
	} else if (y <= 2.8e+43) {
		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 = (-0.5d0) * (z * (z / y))
    if (y <= (-3.3d+42)) then
        tmp = y * 0.5d0
    else if (y <= 6.8d-71) then
        tmp = t_0
    else if (y <= 9.5d-22) then
        tmp = x * (x / (y * 2.0d0))
    else if (y <= 2.8d+43) 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 = -0.5 * (z * (z / y));
	double tmp;
	if (y <= -3.3e+42) {
		tmp = y * 0.5;
	} else if (y <= 6.8e-71) {
		tmp = t_0;
	} else if (y <= 9.5e-22) {
		tmp = x * (x / (y * 2.0));
	} else if (y <= 2.8e+43) {
		tmp = t_0;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -0.5 * (z * (z / y))
	tmp = 0
	if y <= -3.3e+42:
		tmp = y * 0.5
	elif y <= 6.8e-71:
		tmp = t_0
	elif y <= 9.5e-22:
		tmp = x * (x / (y * 2.0))
	elif y <= 2.8e+43:
		tmp = t_0
	else:
		tmp = y * 0.5
	return tmp
function code(x, y, z)
	t_0 = Float64(-0.5 * Float64(z * Float64(z / y)))
	tmp = 0.0
	if (y <= -3.3e+42)
		tmp = Float64(y * 0.5);
	elseif (y <= 6.8e-71)
		tmp = t_0;
	elseif (y <= 9.5e-22)
		tmp = Float64(x * Float64(x / Float64(y * 2.0)));
	elseif (y <= 2.8e+43)
		tmp = t_0;
	else
		tmp = Float64(y * 0.5);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -0.5 * (z * (z / y));
	tmp = 0.0;
	if (y <= -3.3e+42)
		tmp = y * 0.5;
	elseif (y <= 6.8e-71)
		tmp = t_0;
	elseif (y <= 9.5e-22)
		tmp = x * (x / (y * 2.0));
	elseif (y <= 2.8e+43)
		tmp = t_0;
	else
		tmp = y * 0.5;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-0.5 * N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.3e+42], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, 6.8e-71], t$95$0, If[LessEqual[y, 9.5e-22], N[(x * N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8e+43], t$95$0, N[(y * 0.5), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 6.8 \cdot 10^{-71}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 9.5 \cdot 10^{-22}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\

\mathbf{elif}\;y \leq 2.8 \cdot 10^{+43}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.2999999999999999e42 or 2.80000000000000019e43 < y

    1. Initial program 44.2%

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

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

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    4. Simplified74.3%

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

    if -3.2999999999999999e42 < y < 6.80000000000000007e-71 or 9.4999999999999994e-22 < y < 2.80000000000000019e43

    1. Initial program 88.8%

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

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

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

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

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

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

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

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

    if 6.80000000000000007e-71 < y < 9.4999999999999994e-22

    1. Initial program 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.3 \cdot 10^{+42}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{-71}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-22}:\\ \;\;\;\;x \cdot \frac{x}{y \cdot 2}\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+43}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]

Alternative 8: 53.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{if}\;y \leq -1.55 \cdot 10^{+43}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{-69}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{-22}:\\ \;\;\;\;\frac{x \cdot x}{y \cdot 2}\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+44}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -0.5 (* z (/ z y)))))
   (if (<= y -1.55e+43)
     (* y 0.5)
     (if (<= y 1.25e-69)
       t_0
       (if (<= y 1.35e-22)
         (/ (* x x) (* y 2.0))
         (if (<= y 1.3e+44) t_0 (* y 0.5)))))))
double code(double x, double y, double z) {
	double t_0 = -0.5 * (z * (z / y));
	double tmp;
	if (y <= -1.55e+43) {
		tmp = y * 0.5;
	} else if (y <= 1.25e-69) {
		tmp = t_0;
	} else if (y <= 1.35e-22) {
		tmp = (x * x) / (y * 2.0);
	} else if (y <= 1.3e+44) {
		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 = (-0.5d0) * (z * (z / y))
    if (y <= (-1.55d+43)) then
        tmp = y * 0.5d0
    else if (y <= 1.25d-69) then
        tmp = t_0
    else if (y <= 1.35d-22) then
        tmp = (x * x) / (y * 2.0d0)
    else if (y <= 1.3d+44) 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 = -0.5 * (z * (z / y));
	double tmp;
	if (y <= -1.55e+43) {
		tmp = y * 0.5;
	} else if (y <= 1.25e-69) {
		tmp = t_0;
	} else if (y <= 1.35e-22) {
		tmp = (x * x) / (y * 2.0);
	} else if (y <= 1.3e+44) {
		tmp = t_0;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -0.5 * (z * (z / y))
	tmp = 0
	if y <= -1.55e+43:
		tmp = y * 0.5
	elif y <= 1.25e-69:
		tmp = t_0
	elif y <= 1.35e-22:
		tmp = (x * x) / (y * 2.0)
	elif y <= 1.3e+44:
		tmp = t_0
	else:
		tmp = y * 0.5
	return tmp
function code(x, y, z)
	t_0 = Float64(-0.5 * Float64(z * Float64(z / y)))
	tmp = 0.0
	if (y <= -1.55e+43)
		tmp = Float64(y * 0.5);
	elseif (y <= 1.25e-69)
		tmp = t_0;
	elseif (y <= 1.35e-22)
		tmp = Float64(Float64(x * x) / Float64(y * 2.0));
	elseif (y <= 1.3e+44)
		tmp = t_0;
	else
		tmp = Float64(y * 0.5);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -0.5 * (z * (z / y));
	tmp = 0.0;
	if (y <= -1.55e+43)
		tmp = y * 0.5;
	elseif (y <= 1.25e-69)
		tmp = t_0;
	elseif (y <= 1.35e-22)
		tmp = (x * x) / (y * 2.0);
	elseif (y <= 1.3e+44)
		tmp = t_0;
	else
		tmp = y * 0.5;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-0.5 * N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.55e+43], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, 1.25e-69], t$95$0, If[LessEqual[y, 1.35e-22], N[(N[(x * x), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e+44], t$95$0, N[(y * 0.5), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.25 \cdot 10^{-69}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 1.35 \cdot 10^{-22}:\\
\;\;\;\;\frac{x \cdot x}{y \cdot 2}\\

\mathbf{elif}\;y \leq 1.3 \cdot 10^{+44}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.5500000000000001e43 or 1.3e44 < y

    1. Initial program 44.2%

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

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

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    4. Simplified74.3%

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

    if -1.5500000000000001e43 < y < 1.25000000000000008e-69 or 1.3500000000000001e-22 < y < 1.3e44

    1. Initial program 88.8%

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

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

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

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

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

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

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

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

    if 1.25000000000000008e-69 < y < 1.3500000000000001e-22

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.55 \cdot 10^{+43}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{-69}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{-22}:\\ \;\;\;\;\frac{x \cdot x}{y \cdot 2}\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+44}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]

Alternative 9: 75.4% accurate, 1.1× speedup?

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

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

\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 (*.f64 x x) < 1e269

    1. Initial program 75.8%

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

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

        \[\leadsto \frac{\color{blue}{\left(-z \cdot z\right) + \left(x \cdot x + y \cdot y\right)}}{y \cdot 2} \]
      3. neg-sub075.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-75.8%

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z \cdot z - \left(x \cdot x + y \cdot y\right)\right)}}{y \cdot 2} \]
      7. *-commutative75.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-frac75.8%

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

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

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

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

        \[\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/76.9%

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

        \[\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 z around inf 84.4%

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

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

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

    if 1e269 < (*.f64 x x)

    1. Initial program 52.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 99.9% accurate, 1.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
    10. div-sub69.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-squares74.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. +-commutative74.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-*l/76.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. *-commutative76.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. Final simplification99.9%

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

Alternative 11: 43.7% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 3.7 \cdot 10^{+96}:\\ \;\;\;\;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 (<= x 3.7e+96) (* y 0.5) (* x (* x (/ 0.5 y)))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= 3.7e+96) {
		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 <= 3.7d+96) 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 <= 3.7e+96) {
		tmp = y * 0.5;
	} else {
		tmp = x * (x * (0.5 / y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= 3.7e+96:
		tmp = y * 0.5
	else:
		tmp = x * (x * (0.5 / y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= 3.7e+96)
		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 <= 3.7e+96)
		tmp = y * 0.5;
	else
		tmp = x * (x * (0.5 / y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, 3.7e+96], 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 3.7 \cdot 10^{+96}:\\
\;\;\;\;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 < 3.69999999999999991e96

    1. Initial program 72.1%

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

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

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

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

    if 3.69999999999999991e96 < x

    1. Initial program 57.1%

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 34.5% 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 69.7%

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

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

      \[\leadsto \color{blue}{y \cdot 0.5} \]
  4. Simplified39.0%

    \[\leadsto \color{blue}{y \cdot 0.5} \]
  5. Final simplification39.0%

    \[\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 2023257 
(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)))