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

Percentage Accurate: 69.4% → 99.9%
Time: 8.0s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 69.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.2× speedup?

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

\\
\left(\left(x + z\right) \cdot \frac{z - x}{y} - y\right) \cdot -0.5
\end{array}
Derivation
  1. Initial program 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-squares76.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. +-commutative76.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-*r/78.2%

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

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

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

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

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

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

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

Alternative 2: 86.7% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 74.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5e79 < (*.f64 z z) < 9.9999999999999996e274

    1. Initial program 87.2%

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

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

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

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{z \cdot z}}{y} \]
      3. difference-of-squares81.4%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x + z}{\frac{y}{x - z}}} \]
      5. +-commutative86.2%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{z + x}{\frac{y}{x - z}}} \]
    5. Step-by-step derivation
      1. clear-num86.1%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{\frac{y}{x - z}}{z + x}}} \]
      2. +-commutative86.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\frac{y}{x - z}}{\color{blue}{x + z}}} \]
      3. associate-/r/86.2%

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

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

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

    if 9.9999999999999996e274 < (*.f64 z z)

    1. Initial program 59.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 88.0% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 74.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5e79 < (*.f64 z z) < 1.9999999999999999e261

    1. Initial program 88.1%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x + z}{\frac{y}{x - z}}} \]
      5. +-commutative87.2%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{z + x}{\frac{y}{x - z}}} \]
    5. Step-by-step derivation
      1. clear-num87.2%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{\frac{y}{x - z}}{z + x}}} \]
      2. +-commutative87.2%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\frac{y}{x - z}}{\color{blue}{x + z}}} \]
      3. associate-/r/87.2%

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

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

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

    if 1.9999999999999999e261 < (*.f64 z z)

    1. Initial program 61.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 88.0% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 74.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5e79 < (*.f64 z z) < 1.9999999999999999e261

    1. Initial program 88.1%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x + z}{\frac{y}{x - z}}} \]
      5. +-commutative87.2%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{z + x}{\frac{y}{x - z}}} \]
    5. Step-by-step derivation
      1. clear-num87.2%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{\frac{y}{x - z}}{z + x}}} \]
      2. +-commutative87.2%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\frac{y}{x - z}}{\color{blue}{x + z}}} \]
      3. associate-/r/87.2%

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

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

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

    if 1.9999999999999999e261 < (*.f64 z z)

    1. Initial program 61.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 51.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\ t_1 := -0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{if}\;y \leq -3.2 \cdot 10^{+45}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq -9.2 \cdot 10^{-38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-251}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-141}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3 \cdot 10^{-51}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ x (/ y x)))) (t_1 (* -0.5 (* z (/ z y)))))
   (if (<= y -3.2e+45)
     (* y 0.5)
     (if (<= y -9.2e-38)
       t_1
       (if (<= y -1.7e-251)
         t_0
         (if (<= y 2e-141) t_1 (if (<= y 3e-51) t_0 (* y 0.5))))))))
double code(double x, double y, double z) {
	double t_0 = 0.5 * (x / (y / x));
	double t_1 = -0.5 * (z * (z / y));
	double tmp;
	if (y <= -3.2e+45) {
		tmp = y * 0.5;
	} else if (y <= -9.2e-38) {
		tmp = t_1;
	} else if (y <= -1.7e-251) {
		tmp = t_0;
	} else if (y <= 2e-141) {
		tmp = t_1;
	} else if (y <= 3e-51) {
		tmp = t_0;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 * (x / (y / x))
    t_1 = (-0.5d0) * (z * (z / y))
    if (y <= (-3.2d+45)) then
        tmp = y * 0.5d0
    else if (y <= (-9.2d-38)) then
        tmp = t_1
    else if (y <= (-1.7d-251)) then
        tmp = t_0
    else if (y <= 2d-141) then
        tmp = t_1
    else if (y <= 3d-51) 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 * (x / (y / x));
	double t_1 = -0.5 * (z * (z / y));
	double tmp;
	if (y <= -3.2e+45) {
		tmp = y * 0.5;
	} else if (y <= -9.2e-38) {
		tmp = t_1;
	} else if (y <= -1.7e-251) {
		tmp = t_0;
	} else if (y <= 2e-141) {
		tmp = t_1;
	} else if (y <= 3e-51) {
		tmp = t_0;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 0.5 * (x / (y / x))
	t_1 = -0.5 * (z * (z / y))
	tmp = 0
	if y <= -3.2e+45:
		tmp = y * 0.5
	elif y <= -9.2e-38:
		tmp = t_1
	elif y <= -1.7e-251:
		tmp = t_0
	elif y <= 2e-141:
		tmp = t_1
	elif y <= 3e-51:
		tmp = t_0
	else:
		tmp = y * 0.5
	return tmp
function code(x, y, z)
	t_0 = Float64(0.5 * Float64(x / Float64(y / x)))
	t_1 = Float64(-0.5 * Float64(z * Float64(z / y)))
	tmp = 0.0
	if (y <= -3.2e+45)
		tmp = Float64(y * 0.5);
	elseif (y <= -9.2e-38)
		tmp = t_1;
	elseif (y <= -1.7e-251)
		tmp = t_0;
	elseif (y <= 2e-141)
		tmp = t_1;
	elseif (y <= 3e-51)
		tmp = t_0;
	else
		tmp = Float64(y * 0.5);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 0.5 * (x / (y / x));
	t_1 = -0.5 * (z * (z / y));
	tmp = 0.0;
	if (y <= -3.2e+45)
		tmp = y * 0.5;
	elseif (y <= -9.2e-38)
		tmp = t_1;
	elseif (y <= -1.7e-251)
		tmp = t_0;
	elseif (y <= 2e-141)
		tmp = t_1;
	elseif (y <= 3e-51)
		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[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.5 * N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.2e+45], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, -9.2e-38], t$95$1, If[LessEqual[y, -1.7e-251], t$95$0, If[LessEqual[y, 2e-141], t$95$1, If[LessEqual[y, 3e-51], t$95$0, N[(y * 0.5), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -9.2 \cdot 10^{-38}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.7 \cdot 10^{-251}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 2 \cdot 10^{-141}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 3 \cdot 10^{-51}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.2000000000000003e45 or 3.00000000000000002e-51 < y

    1. Initial program 57.6%

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

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

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

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

    if -3.2000000000000003e45 < y < -9.20000000000000007e-38 or -1.70000000000000008e-251 < y < 2.0000000000000001e-141

    1. Initial program 90.3%

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

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

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

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

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

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

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

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

    if -9.20000000000000007e-38 < y < -1.70000000000000008e-251 or 2.0000000000000001e-141 < y < 3.00000000000000002e-51

    1. Initial program 89.9%

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

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

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

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{z \cdot z}}{y} \]
      3. difference-of-squares96.4%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{y}{x}}} \]
    7. Simplified67.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{+45}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq -9.2 \cdot 10^{-38}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-251}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-141}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 3 \cdot 10^{-51}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]

Alternative 6: 85.8% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+39} \lor \neg \left(z \leq 2.45 \cdot 10^{+123}\right):\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y} - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.9999999999999999e39 or 2.44999999999999988e123 < z

    1. Initial program 65.3%

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

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

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

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

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

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

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

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

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

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

        \[\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-squares76.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. +-commutative76.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.9999999999999999e39 < z < 2.44999999999999988e123

    1. Initial program 75.9%

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

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

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

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

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

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

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

        \[\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-*r/76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 85.7% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+48} \lor \neg \left(z \leq 2.55 \cdot 10^{+123}\right):\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y} - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.4999999999999997e48 or 2.54999999999999986e123 < z

    1. Initial program 65.3%

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

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

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

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

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

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

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

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

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

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

        \[\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-squares76.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. +-commutative76.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.4999999999999997e48 < z < 2.54999999999999986e123

    1. Initial program 75.9%

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

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

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

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

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

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

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

        \[\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-*r/76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 80.1% accurate, 1.1× speedup?

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

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

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


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

    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-*r/78.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e220 < (*.f64 x x)

    1. Initial program 66.4%

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

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

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

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{z \cdot z}}{y} \]
      3. difference-of-squares75.8%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x + z}{\frac{y}{x - z}}} \]
      5. +-commutative85.5%

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

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

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

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{y}{x}}} \]
    8. Taylor expanded in x around 0 67.7%

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

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

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

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

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

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

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

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

Alternative 9: 50.8% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-30}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;y \leq 2.7 \cdot 10^{-51}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.99999999999999972e-30 or 2.6999999999999997e-51 < y

    1. Initial program 60.6%

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

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

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

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

    if -4.99999999999999972e-30 < y < 2.6999999999999997e-51

    1. Initial program 89.9%

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

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

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

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{z \cdot z}}{y} \]
      3. difference-of-squares96.0%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x + z}{\frac{y}{x - z}}} \]
      5. +-commutative96.9%

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{y}{x}}} \]
    7. Simplified53.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-30}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{-51}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]

Alternative 10: 52.2% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5000000:\\
\;\;\;\;y \cdot 0.5\\

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


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

    1. Initial program 74.9%

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

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

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

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

    if 5e6 < (*.f64 x x)

    1. Initial program 70.2%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x + z}{\frac{y}{x - z}}} \]
      5. +-commutative81.5%

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{y}{x}}} \]
    7. Simplified65.6%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{y}{x}}} \]
    8. Taylor expanded in x around 0 60.2%

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

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

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

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

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

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

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

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

Alternative 11: 34.1% accurate, 5.0× speedup?

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot 0.5} \]
  5. Final simplification36.2%

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