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

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

\\
\left(\left(z - x\right) \cdot \frac{z + x}{y} - 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-squares75.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. +-commutative75.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/77.6%

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

      \[\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 \left(\left(z - x\right) \cdot \frac{z + x}{y} - y\right) \cdot -0.5 \]

Alternative 2: 53.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{x}{y \cdot 2}\\ t_1 := -0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{if}\;x \leq -1.02 \cdot 10^{+85}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -0.0001:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.05 \cdot 10^{-85}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-256}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{+48}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (/ x (* y 2.0)))) (t_1 (* -0.5 (* z (/ z y)))))
   (if (<= x -1.02e+85)
     t_0
     (if (<= x -0.0001)
       t_1
       (if (<= x -1.05e-85)
         (* y 0.5)
         (if (<= x -2.6e-256) t_1 (if (<= x 2.6e+48) (* y 0.5) t_0)))))))
double code(double x, double y, double z) {
	double t_0 = x * (x / (y * 2.0));
	double t_1 = -0.5 * (z * (z / y));
	double tmp;
	if (x <= -1.02e+85) {
		tmp = t_0;
	} else if (x <= -0.0001) {
		tmp = t_1;
	} else if (x <= -1.05e-85) {
		tmp = y * 0.5;
	} else if (x <= -2.6e-256) {
		tmp = t_1;
	} else if (x <= 2.6e+48) {
		tmp = y * 0.5;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * (x / (y * 2.0d0))
    t_1 = (-0.5d0) * (z * (z / y))
    if (x <= (-1.02d+85)) then
        tmp = t_0
    else if (x <= (-0.0001d0)) then
        tmp = t_1
    else if (x <= (-1.05d-85)) then
        tmp = y * 0.5d0
    else if (x <= (-2.6d-256)) then
        tmp = t_1
    else if (x <= 2.6d+48) then
        tmp = y * 0.5d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (x / (y * 2.0));
	double t_1 = -0.5 * (z * (z / y));
	double tmp;
	if (x <= -1.02e+85) {
		tmp = t_0;
	} else if (x <= -0.0001) {
		tmp = t_1;
	} else if (x <= -1.05e-85) {
		tmp = y * 0.5;
	} else if (x <= -2.6e-256) {
		tmp = t_1;
	} else if (x <= 2.6e+48) {
		tmp = y * 0.5;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (x / (y * 2.0))
	t_1 = -0.5 * (z * (z / y))
	tmp = 0
	if x <= -1.02e+85:
		tmp = t_0
	elif x <= -0.0001:
		tmp = t_1
	elif x <= -1.05e-85:
		tmp = y * 0.5
	elif x <= -2.6e-256:
		tmp = t_1
	elif x <= 2.6e+48:
		tmp = y * 0.5
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(x / Float64(y * 2.0)))
	t_1 = Float64(-0.5 * Float64(z * Float64(z / y)))
	tmp = 0.0
	if (x <= -1.02e+85)
		tmp = t_0;
	elseif (x <= -0.0001)
		tmp = t_1;
	elseif (x <= -1.05e-85)
		tmp = Float64(y * 0.5);
	elseif (x <= -2.6e-256)
		tmp = t_1;
	elseif (x <= 2.6e+48)
		tmp = Float64(y * 0.5);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (x / (y * 2.0));
	t_1 = -0.5 * (z * (z / y));
	tmp = 0.0;
	if (x <= -1.02e+85)
		tmp = t_0;
	elseif (x <= -0.0001)
		tmp = t_1;
	elseif (x <= -1.05e-85)
		tmp = y * 0.5;
	elseif (x <= -2.6e-256)
		tmp = t_1;
	elseif (x <= 2.6e+48)
		tmp = y * 0.5;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.5 * N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.02e+85], t$95$0, If[LessEqual[x, -0.0001], t$95$1, If[LessEqual[x, -1.05e-85], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, -2.6e-256], t$95$1, If[LessEqual[x, 2.6e+48], N[(y * 0.5), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -0.0001:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -1.05 \cdot 10^{-85}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;x \leq -2.6 \cdot 10^{-256}:\\
\;\;\;\;t_1\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.02e85 or 2.59999999999999995e48 < x

    1. Initial program 63.9%

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

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

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

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

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

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

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

    if -1.02e85 < x < -1.00000000000000005e-4 or -1.05e-85 < x < -2.6000000000000001e-256

    1. Initial program 81.1%

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

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

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

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

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

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

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

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

    if -1.00000000000000005e-4 < x < -1.05e-85 or -2.6000000000000001e-256 < x < 2.59999999999999995e48

    1. Initial program 67.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.02 \cdot 10^{+85}:\\ \;\;\;\;x \cdot \frac{x}{y \cdot 2}\\ \mathbf{elif}\;x \leq -0.0001:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;x \leq -1.05 \cdot 10^{-85}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-256}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{+48}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{x}{y \cdot 2}\\ \end{array} \]

Alternative 3: 53.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{if}\;x \leq -1.02 \cdot 10^{+85}:\\ \;\;\;\;x \cdot \frac{x}{y \cdot 2}\\ \mathbf{elif}\;x \leq -7 \cdot 10^{-5}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.08 \cdot 10^{-84}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;x \leq -7.5 \cdot 10^{-257}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{+48}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -0.5 (* z (/ z y)))))
   (if (<= x -1.02e+85)
     (* x (/ x (* y 2.0)))
     (if (<= x -7e-5)
       t_0
       (if (<= x -1.08e-84)
         (* y 0.5)
         (if (<= x -7.5e-257)
           t_0
           (if (<= x 4.5e+48) (* y 0.5) (* 0.5 (/ x (/ y x))))))))))
double code(double x, double y, double z) {
	double t_0 = -0.5 * (z * (z / y));
	double tmp;
	if (x <= -1.02e+85) {
		tmp = x * (x / (y * 2.0));
	} else if (x <= -7e-5) {
		tmp = t_0;
	} else if (x <= -1.08e-84) {
		tmp = y * 0.5;
	} else if (x <= -7.5e-257) {
		tmp = t_0;
	} else if (x <= 4.5e+48) {
		tmp = y * 0.5;
	} else {
		tmp = 0.5 * (x / (y / x));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-0.5d0) * (z * (z / y))
    if (x <= (-1.02d+85)) then
        tmp = x * (x / (y * 2.0d0))
    else if (x <= (-7d-5)) then
        tmp = t_0
    else if (x <= (-1.08d-84)) then
        tmp = y * 0.5d0
    else if (x <= (-7.5d-257)) then
        tmp = t_0
    else if (x <= 4.5d+48) then
        tmp = y * 0.5d0
    else
        tmp = 0.5d0 * (x / (y / x))
    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 (x <= -1.02e+85) {
		tmp = x * (x / (y * 2.0));
	} else if (x <= -7e-5) {
		tmp = t_0;
	} else if (x <= -1.08e-84) {
		tmp = y * 0.5;
	} else if (x <= -7.5e-257) {
		tmp = t_0;
	} else if (x <= 4.5e+48) {
		tmp = y * 0.5;
	} else {
		tmp = 0.5 * (x / (y / x));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -0.5 * (z * (z / y))
	tmp = 0
	if x <= -1.02e+85:
		tmp = x * (x / (y * 2.0))
	elif x <= -7e-5:
		tmp = t_0
	elif x <= -1.08e-84:
		tmp = y * 0.5
	elif x <= -7.5e-257:
		tmp = t_0
	elif x <= 4.5e+48:
		tmp = y * 0.5
	else:
		tmp = 0.5 * (x / (y / x))
	return tmp
function code(x, y, z)
	t_0 = Float64(-0.5 * Float64(z * Float64(z / y)))
	tmp = 0.0
	if (x <= -1.02e+85)
		tmp = Float64(x * Float64(x / Float64(y * 2.0)));
	elseif (x <= -7e-5)
		tmp = t_0;
	elseif (x <= -1.08e-84)
		tmp = Float64(y * 0.5);
	elseif (x <= -7.5e-257)
		tmp = t_0;
	elseif (x <= 4.5e+48)
		tmp = Float64(y * 0.5);
	else
		tmp = Float64(0.5 * Float64(x / Float64(y / x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -0.5 * (z * (z / y));
	tmp = 0.0;
	if (x <= -1.02e+85)
		tmp = x * (x / (y * 2.0));
	elseif (x <= -7e-5)
		tmp = t_0;
	elseif (x <= -1.08e-84)
		tmp = y * 0.5;
	elseif (x <= -7.5e-257)
		tmp = t_0;
	elseif (x <= 4.5e+48)
		tmp = y * 0.5;
	else
		tmp = 0.5 * (x / (y / x));
	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[x, -1.02e+85], N[(x * N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7e-5], t$95$0, If[LessEqual[x, -1.08e-84], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, -7.5e-257], t$95$0, If[LessEqual[x, 4.5e+48], N[(y * 0.5), $MachinePrecision], N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -7 \cdot 10^{-5}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -1.08 \cdot 10^{-84}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;x \leq -7.5 \cdot 10^{-257}:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.02e85

    1. Initial program 60.4%

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

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

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

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

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

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

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

    if -1.02e85 < x < -6.9999999999999994e-5 or -1.0800000000000001e-84 < x < -7.4999999999999995e-257

    1. Initial program 81.1%

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

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

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

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

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

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

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

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

    if -6.9999999999999994e-5 < x < -1.0800000000000001e-84 or -7.4999999999999995e-257 < x < 4.49999999999999995e48

    1. Initial program 67.5%

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

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

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

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

    if 4.49999999999999995e48 < x

    1. Initial program 67.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.02 \cdot 10^{+85}:\\ \;\;\;\;x \cdot \frac{x}{y \cdot 2}\\ \mathbf{elif}\;x \leq -7 \cdot 10^{-5}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;x \leq -1.08 \cdot 10^{-84}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;x \leq -7.5 \cdot 10^{-257}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{+48}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \end{array} \]

Alternative 4: 53.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{+84}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\

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

\mathbf{elif}\;x \leq -1.45 \cdot 10^{-84}:\\
\;\;\;\;y \cdot 0.5\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -9.49999999999999979e84

    1. Initial program 60.4%

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

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

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

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

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

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

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

    if -9.49999999999999979e84 < x < -9.5000000000000005e-5

    1. Initial program 79.3%

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

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

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

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

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

    if -9.5000000000000005e-5 < x < -1.4500000000000001e-84 or -8.7999999999999995e-257 < x < 5.1999999999999999e48

    1. Initial program 67.5%

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

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

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

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

    if -1.4500000000000001e-84 < x < -8.7999999999999995e-257

    1. Initial program 81.8%

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

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

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

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

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

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

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

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

    if 5.1999999999999999e48 < x

    1. Initial program 67.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+84}:\\ \;\;\;\;x \cdot \frac{x}{y \cdot 2}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-5}:\\ \;\;\;\;-0.5 \cdot \frac{z \cdot z}{y}\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-84}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;x \leq -8.8 \cdot 10^{-257}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{+48}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \end{array} \]

Alternative 5: 79.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{x}{y \cdot 2}\\ t_1 := -0.5 \cdot \left(z \cdot \frac{z}{y} - y\right)\\ \mathbf{if}\;x \leq -1.02 \cdot 10^{+86}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{+48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{+100}:\\ \;\;\;\;\frac{x \cdot x}{y \cdot 2}\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{+175}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (/ x (* y 2.0)))) (t_1 (* -0.5 (- (* z (/ z y)) y))))
   (if (<= x -1.02e+86)
     t_0
     (if (<= x 6.2e+48)
       t_1
       (if (<= x 5.4e+100)
         (/ (* x x) (* y 2.0))
         (if (<= x 7.5e+175) t_1 t_0))))))
double code(double x, double y, double z) {
	double t_0 = x * (x / (y * 2.0));
	double t_1 = -0.5 * ((z * (z / y)) - y);
	double tmp;
	if (x <= -1.02e+86) {
		tmp = t_0;
	} else if (x <= 6.2e+48) {
		tmp = t_1;
	} else if (x <= 5.4e+100) {
		tmp = (x * x) / (y * 2.0);
	} else if (x <= 7.5e+175) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * (x / (y * 2.0d0))
    t_1 = (-0.5d0) * ((z * (z / y)) - y)
    if (x <= (-1.02d+86)) then
        tmp = t_0
    else if (x <= 6.2d+48) then
        tmp = t_1
    else if (x <= 5.4d+100) then
        tmp = (x * x) / (y * 2.0d0)
    else if (x <= 7.5d+175) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (x / (y * 2.0));
	double t_1 = -0.5 * ((z * (z / y)) - y);
	double tmp;
	if (x <= -1.02e+86) {
		tmp = t_0;
	} else if (x <= 6.2e+48) {
		tmp = t_1;
	} else if (x <= 5.4e+100) {
		tmp = (x * x) / (y * 2.0);
	} else if (x <= 7.5e+175) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (x / (y * 2.0))
	t_1 = -0.5 * ((z * (z / y)) - y)
	tmp = 0
	if x <= -1.02e+86:
		tmp = t_0
	elif x <= 6.2e+48:
		tmp = t_1
	elif x <= 5.4e+100:
		tmp = (x * x) / (y * 2.0)
	elif x <= 7.5e+175:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(x / Float64(y * 2.0)))
	t_1 = Float64(-0.5 * Float64(Float64(z * Float64(z / y)) - y))
	tmp = 0.0
	if (x <= -1.02e+86)
		tmp = t_0;
	elseif (x <= 6.2e+48)
		tmp = t_1;
	elseif (x <= 5.4e+100)
		tmp = Float64(Float64(x * x) / Float64(y * 2.0));
	elseif (x <= 7.5e+175)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (x / (y * 2.0));
	t_1 = -0.5 * ((z * (z / y)) - y);
	tmp = 0.0;
	if (x <= -1.02e+86)
		tmp = t_0;
	elseif (x <= 6.2e+48)
		tmp = t_1;
	elseif (x <= 5.4e+100)
		tmp = (x * x) / (y * 2.0);
	elseif (x <= 7.5e+175)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.5 * N[(N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.02e+86], t$95$0, If[LessEqual[x, 6.2e+48], t$95$1, If[LessEqual[x, 5.4e+100], N[(N[(x * x), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e+175], t$95$1, t$95$0]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 6.2 \cdot 10^{+48}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 5.4 \cdot 10^{+100}:\\
\;\;\;\;\frac{x \cdot x}{y \cdot 2}\\

\mathbf{elif}\;x \leq 7.5 \cdot 10^{+175}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.01999999999999996e86 or 7.5000000000000001e175 < x

    1. Initial program 61.4%

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

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

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

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

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

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

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

    if -1.01999999999999996e86 < x < 6.20000000000000011e48 or 5.39999999999999997e100 < x < 7.5000000000000001e175

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot z - x \cdot x}{y} - \frac{y \cdot y}{y}\right)} \cdot \frac{-1}{2} \]
      11. difference-of-squares71.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. +-commutative71.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/74.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. *-commutative74.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. associate-*r/91.2%

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

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

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

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

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

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

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

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

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

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

    if 6.20000000000000011e48 < x < 5.39999999999999997e100

    1. Initial program 91.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.02 \cdot 10^{+86}:\\ \;\;\;\;x \cdot \frac{x}{y \cdot 2}\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{+48}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y} - y\right)\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{+100}:\\ \;\;\;\;\frac{x \cdot x}{y \cdot 2}\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{+175}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y} - y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{x}{y \cdot 2}\\ \end{array} \]

Alternative 6: 50.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{+123} \lor \neg \left(y \leq 7.6 \cdot 10^{-81}\right) \land \left(y \leq 1.35 \cdot 10^{+30} \lor \neg \left(y \leq 7.5 \cdot 10^{+69}\right)\right):\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -2.2e+123)
         (and (not (<= y 7.6e-81)) (or (<= y 1.35e+30) (not (<= y 7.5e+69)))))
   (* y 0.5)
   (* -0.5 (* z (/ z y)))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -2.2e+123) || (!(y <= 7.6e-81) && ((y <= 1.35e+30) || !(y <= 7.5e+69)))) {
		tmp = y * 0.5;
	} else {
		tmp = -0.5 * (z * (z / y));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-2.2d+123)) .or. (.not. (y <= 7.6d-81)) .and. (y <= 1.35d+30) .or. (.not. (y <= 7.5d+69))) then
        tmp = y * 0.5d0
    else
        tmp = (-0.5d0) * (z * (z / y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -2.2e+123) || (!(y <= 7.6e-81) && ((y <= 1.35e+30) || !(y <= 7.5e+69)))) {
		tmp = y * 0.5;
	} else {
		tmp = -0.5 * (z * (z / y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -2.2e+123) or (not (y <= 7.6e-81) and ((y <= 1.35e+30) or not (y <= 7.5e+69))):
		tmp = y * 0.5
	else:
		tmp = -0.5 * (z * (z / y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -2.2e+123) || (!(y <= 7.6e-81) && ((y <= 1.35e+30) || !(y <= 7.5e+69))))
		tmp = Float64(y * 0.5);
	else
		tmp = Float64(-0.5 * Float64(z * Float64(z / y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -2.2e+123) || (~((y <= 7.6e-81)) && ((y <= 1.35e+30) || ~((y <= 7.5e+69)))))
		tmp = y * 0.5;
	else
		tmp = -0.5 * (z * (z / y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.2e+123], And[N[Not[LessEqual[y, 7.6e-81]], $MachinePrecision], Or[LessEqual[y, 1.35e+30], N[Not[LessEqual[y, 7.5e+69]], $MachinePrecision]]]], N[(y * 0.5), $MachinePrecision], N[(-0.5 * N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+123} \lor \neg \left(y \leq 7.6 \cdot 10^{-81}\right) \land \left(y \leq 1.35 \cdot 10^{+30} \lor \neg \left(y \leq 7.5 \cdot 10^{+69}\right)\right):\\
\;\;\;\;y \cdot 0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.19999999999999992e123 or 7.5999999999999997e-81 < y < 1.3499999999999999e30 or 7.49999999999999939e69 < y

    1. Initial program 41.2%

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

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

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

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

    if -2.19999999999999992e123 < y < 7.5999999999999997e-81 or 1.3499999999999999e30 < y < 7.49999999999999939e69

    1. Initial program 89.5%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{+123} \lor \neg \left(y \leq 7.6 \cdot 10^{-81}\right) \land \left(y \leq 1.35 \cdot 10^{+30} \lor \neg \left(y \leq 7.5 \cdot 10^{+69}\right)\right):\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \end{array} \]

Alternative 7: 88.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.2 \cdot 10^{+43} \lor \neg \left(z \leq 1.8 \cdot 10^{+15}\right):\\ \;\;\;\;-0.5 \cdot \left(\left(z - x\right) \cdot \frac{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 (<= z -3.2e+43) (not (<= z 1.8e+15)))
   (* -0.5 (- (* (- z x) (/ z y)) y))
   (* -0.5 (- (* (- z x) (/ x y)) y))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -3.2e+43) || !(z <= 1.8e+15)) {
		tmp = -0.5 * (((z - x) * (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 ((z <= (-3.2d+43)) .or. (.not. (z <= 1.8d+15))) then
        tmp = (-0.5d0) * (((z - x) * (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 ((z <= -3.2e+43) || !(z <= 1.8e+15)) {
		tmp = -0.5 * (((z - x) * (z / y)) - y);
	} else {
		tmp = -0.5 * (((z - x) * (x / y)) - y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -3.2e+43) or not (z <= 1.8e+15):
		tmp = -0.5 * (((z - x) * (z / y)) - y)
	else:
		tmp = -0.5 * (((z - x) * (x / y)) - y)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -3.2e+43) || !(z <= 1.8e+15))
		tmp = Float64(-0.5 * Float64(Float64(Float64(z - x) * Float64(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 ((z <= -3.2e+43) || ~((z <= 1.8e+15)))
		tmp = -0.5 * (((z - x) * (z / y)) - y);
	else
		tmp = -0.5 * (((z - x) * (x / y)) - y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.2e+43], N[Not[LessEqual[z, 1.8e+15]], $MachinePrecision]], N[(-0.5 * N[(N[(N[(z - x), $MachinePrecision] * N[(z / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(N[(z - x), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+43} \lor \neg \left(z \leq 1.8 \cdot 10^{+15}\right):\\
\;\;\;\;-0.5 \cdot \left(\left(z - x\right) \cdot \frac{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 z < -3.20000000000000014e43 or 1.8e15 < z

    1. Initial program 68.9%

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

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

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

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

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

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

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

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

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

        \[\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/81.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. *-commutative81.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 x around 0 86.8%

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

    if -3.20000000000000014e43 < z < 1.8e15

    1. Initial program 70.4%

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

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

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

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

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

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

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

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

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

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

        \[\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-squares70.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. +-commutative70.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/74.4%

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

        \[\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 x around inf 91.5%

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

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

Alternative 8: 88.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+95}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{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 (<= (* x x) 2e+95)
   (* -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+95) {
		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+95) 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+95) {
		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+95:
		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+95)
		tmp = Float64(-0.5 * Float64(Float64(z * Float64(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+95)
		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[LessEqual[N[(x * x), $MachinePrecision], 2e+95], N[(-0.5 * N[(N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(N[(z - x), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+95}:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{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) < 2.00000000000000004e95

    1. Initial program 72.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
      10. div-sub72.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-squares72.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. +-commutative72.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/75.3%

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

        \[\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. associate-*r/91.8%

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000004e95 < (*.f64 x x)

    1. Initial program 65.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot z - x \cdot x}{y} - \frac{y \cdot y}{y}\right)} \cdot \frac{-1}{2} \]
      11. difference-of-squares79.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. +-commutative79.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/81.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. *-commutative81.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 x around inf 85.2%

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

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

Alternative 9: 85.8% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 72.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
      10. div-sub72.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-squares72.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. +-commutative72.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/75.3%

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

        \[\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. associate-*r/91.8%

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000004e95 < (*.f64 x x)

    1. Initial program 65.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot z - x \cdot x}{y} - \frac{y \cdot y}{y}\right)} \cdot \frac{-1}{2} \]
      11. difference-of-squares79.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. +-commutative79.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/81.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. *-commutative81.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. Step-by-step derivation
      1. associate-*r/88.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 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 35.4%

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

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

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

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