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

Percentage Accurate: 68.6% → 92.3%
Time: 9.9s
Alternatives: 9
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 68.6% 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: 92.3% accurate, 0.1× speedup?

\[\begin{array}{l} x = |x|\\ \\ \begin{array}{l} t_0 := 0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\ \mathbf{if}\;x \leq 6 \cdot 10^{+88}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{+139}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, y, \mathsf{fma}\left(x, x, z \cdot \left(-z\right)\right)\right)}{y \cdot 2}\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{+214}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ (* 0.5 (- y (/ z (/ y z)))) (* 0.5 (* x (/ x y))))))
   (if (<= x 6e+88)
     t_0
     (if (<= x 3.5e+139)
       (/ (fma y y (fma x x (* z (- z)))) (* y 2.0))
       (if (<= x 8.4e+214) t_0 (* (/ x y) (/ x 2.0)))))))
x = abs(x);
double code(double x, double y, double z) {
	double t_0 = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
	double tmp;
	if (x <= 6e+88) {
		tmp = t_0;
	} else if (x <= 3.5e+139) {
		tmp = fma(y, y, fma(x, x, (z * -z))) / (y * 2.0);
	} else if (x <= 8.4e+214) {
		tmp = t_0;
	} else {
		tmp = (x / y) * (x / 2.0);
	}
	return tmp;
}
x = abs(x)
function code(x, y, z)
	t_0 = Float64(Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))) + Float64(0.5 * Float64(x * Float64(x / y))))
	tmp = 0.0
	if (x <= 6e+88)
		tmp = t_0;
	elseif (x <= 3.5e+139)
		tmp = Float64(fma(y, y, fma(x, x, Float64(z * Float64(-z)))) / Float64(y * 2.0));
	elseif (x <= 8.4e+214)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / y) * Float64(x / 2.0));
	end
	return tmp
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 6e+88], t$95$0, If[LessEqual[x, 3.5e+139], N[(N[(y * y + N[(x * x + N[(z * (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.4e+214], t$95$0, N[(N[(x / y), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\
\mathbf{if}\;x \leq 6 \cdot 10^{+88}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 3.5 \cdot 10^{+139}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, y, \mathsf{fma}\left(x, x, z \cdot \left(-z\right)\right)\right)}{y \cdot 2}\\

\mathbf{elif}\;x \leq 8.4 \cdot 10^{+214}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 6.00000000000000011e88 or 3.49999999999999978e139 < x < 8.4000000000000003e214

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \left(y - \color{blue}{\frac{z}{1} \cdot \frac{z}{y}}\right) + 0.5 \cdot \left(\frac{x}{1} \cdot \frac{x}{y}\right) \]
    7. Step-by-step derivation
      1. /-rgt-identity95.0%

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

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

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

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

    if 6.00000000000000011e88 < x < 3.49999999999999978e139

    1. Initial program 86.4%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, y, x \cdot x - z \cdot z\right)}}{y \cdot 2} \]
      6. fma-neg93.6%

        \[\leadsto \frac{\mathsf{fma}\left(y, y, \color{blue}{\mathsf{fma}\left(x, x, -z \cdot z\right)}\right)}{y \cdot 2} \]
      7. distribute-rgt-neg-in93.6%

        \[\leadsto \frac{\mathsf{fma}\left(y, y, \mathsf{fma}\left(x, x, \color{blue}{z \cdot \left(-z\right)}\right)\right)}{y \cdot 2} \]
    3. Simplified93.6%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, y, \mathsf{fma}\left(x, x, z \cdot \left(-z\right)\right)\right)}{y \cdot 2}} \]

    if 8.4000000000000003e214 < x

    1. Initial program 63.1%

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity87.0%

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

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

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

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1 \cdot \frac{y}{x}}{x}}} \]
      2. *-lft-identity95.2%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{x}} \]
    8. Simplified95.2%

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{y}{x \cdot x}}} \cdot 0.5 \]
      4. unpow287.0%

        \[\leadsto \frac{1}{\frac{y}{\color{blue}{{x}^{2}}}} \cdot 0.5 \]
      5. clear-num87.0%

        \[\leadsto \color{blue}{\frac{{x}^{2}}{y}} \cdot 0.5 \]
      6. metadata-eval87.0%

        \[\leadsto \frac{{x}^{2}}{y} \cdot \color{blue}{\frac{1}{2}} \]
      7. metadata-eval87.0%

        \[\leadsto \frac{{x}^{2}}{y} \cdot \frac{1}{\color{blue}{{2}^{1}}} \]
      8. metadata-eval87.0%

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

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

        \[\leadsto \color{blue}{\frac{\frac{{x}^{2}}{y}}{{\left(\sqrt{2}\right)}^{2}}} \]
      11. associate-/r*87.0%

        \[\leadsto \color{blue}{\frac{{x}^{2}}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \]
      12. unpow287.0%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot {\left(\sqrt{2}\right)}^{2}} \]
      13. times-frac95.0%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{{\left(\sqrt{2}\right)}^{2}}} \]
      14. sqrt-pow295.2%

        \[\leadsto \frac{x}{y} \cdot \frac{x}{\color{blue}{{2}^{\left(\frac{2}{2}\right)}}} \]
      15. metadata-eval95.2%

        \[\leadsto \frac{x}{y} \cdot \frac{x}{{2}^{\color{blue}{1}}} \]
      16. metadata-eval95.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 6 \cdot 10^{+88}:\\ \;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{+139}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, y, \mathsf{fma}\left(x, x, z \cdot \left(-z\right)\right)\right)}{y \cdot 2}\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{+214}:\\ \;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \end{array} \]

Alternative 2: 94.0% accurate, 0.0× speedup?

\[\begin{array}{l} x = |x|\\ \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+246}:\\ \;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(t_0 \cdot \frac{0.5}{y}\right)\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (hypot y (hypot x z))))
   (if (<= (* x x) 5e+246)
     (+ (* 0.5 (- y (/ z (/ y z)))) (* 0.5 (* x (/ x y))))
     (* t_0 (* t_0 (/ 0.5 y))))))
x = abs(x);
double code(double x, double y, double z) {
	double t_0 = hypot(y, hypot(x, z));
	double tmp;
	if ((x * x) <= 5e+246) {
		tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
	} else {
		tmp = t_0 * (t_0 * (0.5 / y));
	}
	return tmp;
}
x = Math.abs(x);
public static double code(double x, double y, double z) {
	double t_0 = Math.hypot(y, Math.hypot(x, z));
	double tmp;
	if ((x * x) <= 5e+246) {
		tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
	} else {
		tmp = t_0 * (t_0 * (0.5 / y));
	}
	return tmp;
}
x = abs(x)
def code(x, y, z):
	t_0 = math.hypot(y, math.hypot(x, z))
	tmp = 0
	if (x * x) <= 5e+246:
		tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)))
	else:
		tmp = t_0 * (t_0 * (0.5 / y))
	return tmp
x = abs(x)
function code(x, y, z)
	t_0 = hypot(y, hypot(x, z))
	tmp = 0.0
	if (Float64(x * x) <= 5e+246)
		tmp = Float64(Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))) + Float64(0.5 * Float64(x * Float64(x / y))));
	else
		tmp = Float64(t_0 * Float64(t_0 * Float64(0.5 / y)));
	end
	return tmp
end
x = abs(x)
function tmp_2 = code(x, y, z)
	t_0 = hypot(y, hypot(x, z));
	tmp = 0.0;
	if ((x * x) <= 5e+246)
		tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
	else
		tmp = t_0 * (t_0 * (0.5 / y));
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[y ^ 2 + N[Sqrt[x ^ 2 + z ^ 2], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e+246], N[(N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$0 * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+246}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\

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


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

    1. Initial program 75.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999976e246 < (*.f64 x x)

    1. Initial program 63.5%

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

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

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

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

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

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

Alternative 3: 52.7% accurate, 0.7× speedup?

\[\begin{array}{l} x = |x|\\ \\ \begin{array}{l} t_0 := \frac{z \cdot -0.5}{\frac{y}{z}}\\ \mathbf{if}\;y \leq -9 \cdot 10^{+101}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;y \leq -5.4 \cdot 10^{-116}:\\ \;\;\;\;\frac{x \cdot 0.5}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{-224}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-254}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-70}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-8}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 3300000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (* z -0.5) (/ y z))))
   (if (<= y -9e+101)
     (* 0.5 y)
     (if (<= y -5.4e-116)
       (/ (* x 0.5) (/ y x))
       (if (<= y -2.7e-224)
         t_0
         (if (<= y 4.2e-254)
           (* (/ x y) (/ x 2.0))
           (if (<= y 1.3e-70)
             t_0
             (if (<= y 3.8e-8)
               (* x (* x (/ 0.5 y)))
               (if (<= y 3300000000.0) t_0 (* 0.5 y))))))))))
x = abs(x);
double code(double x, double y, double z) {
	double t_0 = (z * -0.5) / (y / z);
	double tmp;
	if (y <= -9e+101) {
		tmp = 0.5 * y;
	} else if (y <= -5.4e-116) {
		tmp = (x * 0.5) / (y / x);
	} else if (y <= -2.7e-224) {
		tmp = t_0;
	} else if (y <= 4.2e-254) {
		tmp = (x / y) * (x / 2.0);
	} else if (y <= 1.3e-70) {
		tmp = t_0;
	} else if (y <= 3.8e-8) {
		tmp = x * (x * (0.5 / y));
	} else if (y <= 3300000000.0) {
		tmp = t_0;
	} else {
		tmp = 0.5 * y;
	}
	return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (z * (-0.5d0)) / (y / z)
    if (y <= (-9d+101)) then
        tmp = 0.5d0 * y
    else if (y <= (-5.4d-116)) then
        tmp = (x * 0.5d0) / (y / x)
    else if (y <= (-2.7d-224)) then
        tmp = t_0
    else if (y <= 4.2d-254) then
        tmp = (x / y) * (x / 2.0d0)
    else if (y <= 1.3d-70) then
        tmp = t_0
    else if (y <= 3.8d-8) then
        tmp = x * (x * (0.5d0 / y))
    else if (y <= 3300000000.0d0) then
        tmp = t_0
    else
        tmp = 0.5d0 * y
    end if
    code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
	double t_0 = (z * -0.5) / (y / z);
	double tmp;
	if (y <= -9e+101) {
		tmp = 0.5 * y;
	} else if (y <= -5.4e-116) {
		tmp = (x * 0.5) / (y / x);
	} else if (y <= -2.7e-224) {
		tmp = t_0;
	} else if (y <= 4.2e-254) {
		tmp = (x / y) * (x / 2.0);
	} else if (y <= 1.3e-70) {
		tmp = t_0;
	} else if (y <= 3.8e-8) {
		tmp = x * (x * (0.5 / y));
	} else if (y <= 3300000000.0) {
		tmp = t_0;
	} else {
		tmp = 0.5 * y;
	}
	return tmp;
}
x = abs(x)
def code(x, y, z):
	t_0 = (z * -0.5) / (y / z)
	tmp = 0
	if y <= -9e+101:
		tmp = 0.5 * y
	elif y <= -5.4e-116:
		tmp = (x * 0.5) / (y / x)
	elif y <= -2.7e-224:
		tmp = t_0
	elif y <= 4.2e-254:
		tmp = (x / y) * (x / 2.0)
	elif y <= 1.3e-70:
		tmp = t_0
	elif y <= 3.8e-8:
		tmp = x * (x * (0.5 / y))
	elif y <= 3300000000.0:
		tmp = t_0
	else:
		tmp = 0.5 * y
	return tmp
x = abs(x)
function code(x, y, z)
	t_0 = Float64(Float64(z * -0.5) / Float64(y / z))
	tmp = 0.0
	if (y <= -9e+101)
		tmp = Float64(0.5 * y);
	elseif (y <= -5.4e-116)
		tmp = Float64(Float64(x * 0.5) / Float64(y / x));
	elseif (y <= -2.7e-224)
		tmp = t_0;
	elseif (y <= 4.2e-254)
		tmp = Float64(Float64(x / y) * Float64(x / 2.0));
	elseif (y <= 1.3e-70)
		tmp = t_0;
	elseif (y <= 3.8e-8)
		tmp = Float64(x * Float64(x * Float64(0.5 / y)));
	elseif (y <= 3300000000.0)
		tmp = t_0;
	else
		tmp = Float64(0.5 * y);
	end
	return tmp
end
x = abs(x)
function tmp_2 = code(x, y, z)
	t_0 = (z * -0.5) / (y / z);
	tmp = 0.0;
	if (y <= -9e+101)
		tmp = 0.5 * y;
	elseif (y <= -5.4e-116)
		tmp = (x * 0.5) / (y / x);
	elseif (y <= -2.7e-224)
		tmp = t_0;
	elseif (y <= 4.2e-254)
		tmp = (x / y) * (x / 2.0);
	elseif (y <= 1.3e-70)
		tmp = t_0;
	elseif (y <= 3.8e-8)
		tmp = x * (x * (0.5 / y));
	elseif (y <= 3300000000.0)
		tmp = t_0;
	else
		tmp = 0.5 * y;
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * -0.5), $MachinePrecision] / N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9e+101], N[(0.5 * y), $MachinePrecision], If[LessEqual[y, -5.4e-116], N[(N[(x * 0.5), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.7e-224], t$95$0, If[LessEqual[y, 4.2e-254], N[(N[(x / y), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e-70], t$95$0, If[LessEqual[y, 3.8e-8], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3300000000.0], t$95$0, N[(0.5 * y), $MachinePrecision]]]]]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := \frac{z \cdot -0.5}{\frac{y}{z}}\\
\mathbf{if}\;y \leq -9 \cdot 10^{+101}:\\
\;\;\;\;0.5 \cdot y\\

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

\mathbf{elif}\;y \leq -2.7 \cdot 10^{-224}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;y \leq 1.3 \cdot 10^{-70}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;y \leq 3300000000:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -9.0000000000000004e101 or 3.3e9 < y

    1. Initial program 35.0%

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

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

    if -9.0000000000000004e101 < y < -5.4e-116

    1. Initial program 93.3%

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

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified57.8%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity57.8%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{1 \cdot y}}{{x}^{2}}} \]
      2. unpow257.8%

        \[\leadsto \frac{0.5}{\frac{1 \cdot y}{\color{blue}{x \cdot x}}} \]
      3. times-frac57.8%

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1}{x} \cdot \frac{y}{x}}} \]
    6. Applied egg-rr57.8%

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1 \cdot \frac{y}{x}}{x}}} \]
      2. *-lft-identity57.8%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{x}} \]
    8. Simplified57.8%

      \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{y}{x}}{x}}} \]
    9. Step-by-step derivation
      1. associate-/l/57.8%

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

        \[\leadsto \frac{0.5}{\frac{y}{\color{blue}{{x}^{2}}}} \]
      3. associate-/r/57.8%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      4. metadata-eval57.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{y} \cdot {x}^{2} \]
      5. metadata-eval57.8%

        \[\leadsto \frac{\frac{1}{\color{blue}{{2}^{1}}}}{y} \cdot {x}^{2} \]
      6. metadata-eval57.8%

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

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

        \[\leadsto \color{blue}{\frac{1}{{\left(\sqrt{2}\right)}^{2} \cdot y}} \cdot {x}^{2} \]
      9. *-commutative57.5%

        \[\leadsto \frac{1}{\color{blue}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \cdot {x}^{2} \]
      10. *-commutative57.5%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \]
      11. unpow257.5%

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

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{1}{y \cdot {\left(\sqrt{2}\right)}^{2}}\right)} \]
      13. *-commutative57.6%

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

        \[\leadsto x \cdot \left(x \cdot \color{blue}{\frac{\frac{1}{{\left(\sqrt{2}\right)}^{2}}}{y}}\right) \]
      15. sqrt-pow257.9%

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{0.5}{y}\right)} \]
    11. Step-by-step derivation
      1. *-commutative57.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot x}{\frac{y}{x}}} \]
    12. Applied egg-rr57.9%

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

    if -5.4e-116 < y < -2.69999999999999998e-224 or 4.19999999999999993e-254 < y < 1.30000000000000001e-70 or 3.80000000000000028e-8 < y < 3.3e9

    1. Initial program 91.2%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{z}{\frac{1}{\frac{z}{y}}}} \cdot -0.5 \]
      2. clear-num59.5%

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

        \[\leadsto \color{blue}{\frac{z \cdot -0.5}{\frac{y}{z}}} \]
    8. Applied egg-rr59.5%

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

    if -2.69999999999999998e-224 < y < 4.19999999999999993e-254

    1. Initial program 87.7%

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity77.3%

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

        \[\leadsto \frac{0.5}{\frac{1 \cdot y}{\color{blue}{x \cdot x}}} \]
      3. times-frac80.1%

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

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1 \cdot \frac{y}{x}}{x}}} \]
      2. *-lft-identity80.2%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{x}} \]
    8. Simplified80.2%

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{y}{x \cdot x}}} \cdot 0.5 \]
      4. unpow274.9%

        \[\leadsto \frac{1}{\frac{y}{\color{blue}{{x}^{2}}}} \cdot 0.5 \]
      5. clear-num75.0%

        \[\leadsto \color{blue}{\frac{{x}^{2}}{y}} \cdot 0.5 \]
      6. metadata-eval75.0%

        \[\leadsto \frac{{x}^{2}}{y} \cdot \color{blue}{\frac{1}{2}} \]
      7. metadata-eval75.0%

        \[\leadsto \frac{{x}^{2}}{y} \cdot \frac{1}{\color{blue}{{2}^{1}}} \]
      8. metadata-eval75.0%

        \[\leadsto \frac{{x}^{2}}{y} \cdot \frac{1}{{2}^{\color{blue}{\left(\frac{2}{2}\right)}}} \]
      9. sqrt-pow274.7%

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

        \[\leadsto \color{blue}{\frac{\frac{{x}^{2}}{y}}{{\left(\sqrt{2}\right)}^{2}}} \]
      11. associate-/r*77.1%

        \[\leadsto \color{blue}{\frac{{x}^{2}}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \]
      12. unpow277.1%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot {\left(\sqrt{2}\right)}^{2}} \]
      13. times-frac80.0%

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

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

        \[\leadsto \frac{x}{y} \cdot \frac{x}{{2}^{\color{blue}{1}}} \]
      16. metadata-eval80.3%

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

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

    if 1.30000000000000001e-70 < y < 3.80000000000000028e-8

    1. Initial program 91.4%

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

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified52.2%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity52.2%

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

        \[\leadsto \frac{0.5}{\frac{1 \cdot y}{\color{blue}{x \cdot x}}} \]
      3. times-frac52.0%

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1}{x} \cdot \frac{y}{x}}} \]
    6. Applied egg-rr52.0%

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1 \cdot \frac{y}{x}}{x}}} \]
      2. *-lft-identity52.0%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{x}} \]
    8. Simplified52.0%

      \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{y}{x}}{x}}} \]
    9. Step-by-step derivation
      1. associate-/l/52.2%

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

        \[\leadsto \frac{0.5}{\frac{y}{\color{blue}{{x}^{2}}}} \]
      3. associate-/r/51.9%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      4. metadata-eval51.9%

        \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{y} \cdot {x}^{2} \]
      5. metadata-eval51.9%

        \[\leadsto \frac{\frac{1}{\color{blue}{{2}^{1}}}}{y} \cdot {x}^{2} \]
      6. metadata-eval51.9%

        \[\leadsto \frac{\frac{1}{{2}^{\color{blue}{\left(\frac{2}{2}\right)}}}}{y} \cdot {x}^{2} \]
      7. sqrt-pow251.6%

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

        \[\leadsto \color{blue}{\frac{1}{{\left(\sqrt{2}\right)}^{2} \cdot y}} \cdot {x}^{2} \]
      9. *-commutative51.6%

        \[\leadsto \frac{1}{\color{blue}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \cdot {x}^{2} \]
      10. *-commutative51.6%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \]
      11. unpow251.6%

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

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{1}{y \cdot {\left(\sqrt{2}\right)}^{2}}\right)} \]
      13. *-commutative51.6%

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

        \[\leadsto x \cdot \left(x \cdot \color{blue}{\frac{\frac{1}{{\left(\sqrt{2}\right)}^{2}}}{y}}\right) \]
      15. sqrt-pow252.2%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+101}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;y \leq -5.4 \cdot 10^{-116}:\\ \;\;\;\;\frac{x \cdot 0.5}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{-224}:\\ \;\;\;\;\frac{z \cdot -0.5}{\frac{y}{z}}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-254}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-70}:\\ \;\;\;\;\frac{z \cdot -0.5}{\frac{y}{z}}\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-8}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 3300000000:\\ \;\;\;\;\frac{z \cdot -0.5}{\frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]

Alternative 4: 52.8% accurate, 0.7× speedup?

\[\begin{array}{l} x = |x|\\ \\ \begin{array}{l} t_0 := \frac{z \cdot -0.5}{\frac{y}{z}}\\ \mathbf{if}\;y \leq -8.6 \cdot 10^{+101}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-114}:\\ \;\;\;\;\frac{x \cdot 0.5}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq -5.4 \cdot 10^{-226}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-255}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{-67}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-8}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 30000000000:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (* z -0.5) (/ y z))))
   (if (<= y -8.6e+101)
     (* 0.5 y)
     (if (<= y -1.7e-114)
       (/ (* x 0.5) (/ y x))
       (if (<= y -5.4e-226)
         t_0
         (if (<= y 4e-255)
           (* (/ x y) (/ x 2.0))
           (if (<= y 1.06e-67)
             t_0
             (if (<= y 5.5e-8)
               (* x (* x (/ 0.5 y)))
               (if (<= y 30000000000.0)
                 (* -0.5 (* z (/ z y)))
                 (* 0.5 y))))))))))
x = abs(x);
double code(double x, double y, double z) {
	double t_0 = (z * -0.5) / (y / z);
	double tmp;
	if (y <= -8.6e+101) {
		tmp = 0.5 * y;
	} else if (y <= -1.7e-114) {
		tmp = (x * 0.5) / (y / x);
	} else if (y <= -5.4e-226) {
		tmp = t_0;
	} else if (y <= 4e-255) {
		tmp = (x / y) * (x / 2.0);
	} else if (y <= 1.06e-67) {
		tmp = t_0;
	} else if (y <= 5.5e-8) {
		tmp = x * (x * (0.5 / y));
	} else if (y <= 30000000000.0) {
		tmp = -0.5 * (z * (z / y));
	} else {
		tmp = 0.5 * y;
	}
	return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (z * (-0.5d0)) / (y / z)
    if (y <= (-8.6d+101)) then
        tmp = 0.5d0 * y
    else if (y <= (-1.7d-114)) then
        tmp = (x * 0.5d0) / (y / x)
    else if (y <= (-5.4d-226)) then
        tmp = t_0
    else if (y <= 4d-255) then
        tmp = (x / y) * (x / 2.0d0)
    else if (y <= 1.06d-67) then
        tmp = t_0
    else if (y <= 5.5d-8) then
        tmp = x * (x * (0.5d0 / y))
    else if (y <= 30000000000.0d0) then
        tmp = (-0.5d0) * (z * (z / y))
    else
        tmp = 0.5d0 * y
    end if
    code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
	double t_0 = (z * -0.5) / (y / z);
	double tmp;
	if (y <= -8.6e+101) {
		tmp = 0.5 * y;
	} else if (y <= -1.7e-114) {
		tmp = (x * 0.5) / (y / x);
	} else if (y <= -5.4e-226) {
		tmp = t_0;
	} else if (y <= 4e-255) {
		tmp = (x / y) * (x / 2.0);
	} else if (y <= 1.06e-67) {
		tmp = t_0;
	} else if (y <= 5.5e-8) {
		tmp = x * (x * (0.5 / y));
	} else if (y <= 30000000000.0) {
		tmp = -0.5 * (z * (z / y));
	} else {
		tmp = 0.5 * y;
	}
	return tmp;
}
x = abs(x)
def code(x, y, z):
	t_0 = (z * -0.5) / (y / z)
	tmp = 0
	if y <= -8.6e+101:
		tmp = 0.5 * y
	elif y <= -1.7e-114:
		tmp = (x * 0.5) / (y / x)
	elif y <= -5.4e-226:
		tmp = t_0
	elif y <= 4e-255:
		tmp = (x / y) * (x / 2.0)
	elif y <= 1.06e-67:
		tmp = t_0
	elif y <= 5.5e-8:
		tmp = x * (x * (0.5 / y))
	elif y <= 30000000000.0:
		tmp = -0.5 * (z * (z / y))
	else:
		tmp = 0.5 * y
	return tmp
x = abs(x)
function code(x, y, z)
	t_0 = Float64(Float64(z * -0.5) / Float64(y / z))
	tmp = 0.0
	if (y <= -8.6e+101)
		tmp = Float64(0.5 * y);
	elseif (y <= -1.7e-114)
		tmp = Float64(Float64(x * 0.5) / Float64(y / x));
	elseif (y <= -5.4e-226)
		tmp = t_0;
	elseif (y <= 4e-255)
		tmp = Float64(Float64(x / y) * Float64(x / 2.0));
	elseif (y <= 1.06e-67)
		tmp = t_0;
	elseif (y <= 5.5e-8)
		tmp = Float64(x * Float64(x * Float64(0.5 / y)));
	elseif (y <= 30000000000.0)
		tmp = Float64(-0.5 * Float64(z * Float64(z / y)));
	else
		tmp = Float64(0.5 * y);
	end
	return tmp
end
x = abs(x)
function tmp_2 = code(x, y, z)
	t_0 = (z * -0.5) / (y / z);
	tmp = 0.0;
	if (y <= -8.6e+101)
		tmp = 0.5 * y;
	elseif (y <= -1.7e-114)
		tmp = (x * 0.5) / (y / x);
	elseif (y <= -5.4e-226)
		tmp = t_0;
	elseif (y <= 4e-255)
		tmp = (x / y) * (x / 2.0);
	elseif (y <= 1.06e-67)
		tmp = t_0;
	elseif (y <= 5.5e-8)
		tmp = x * (x * (0.5 / y));
	elseif (y <= 30000000000.0)
		tmp = -0.5 * (z * (z / y));
	else
		tmp = 0.5 * y;
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * -0.5), $MachinePrecision] / N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.6e+101], N[(0.5 * y), $MachinePrecision], If[LessEqual[y, -1.7e-114], N[(N[(x * 0.5), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -5.4e-226], t$95$0, If[LessEqual[y, 4e-255], N[(N[(x / y), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.06e-67], t$95$0, If[LessEqual[y, 5.5e-8], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 30000000000.0], N[(-0.5 * N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]]]]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := \frac{z \cdot -0.5}{\frac{y}{z}}\\
\mathbf{if}\;y \leq -8.6 \cdot 10^{+101}:\\
\;\;\;\;0.5 \cdot y\\

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

\mathbf{elif}\;y \leq -5.4 \cdot 10^{-226}:\\
\;\;\;\;t_0\\

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if y < -8.6000000000000002e101 or 3e10 < y

    1. Initial program 35.0%

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

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

    if -8.6000000000000002e101 < y < -1.69999999999999991e-114

    1. Initial program 93.3%

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

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified57.8%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity57.8%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{1 \cdot y}}{{x}^{2}}} \]
      2. unpow257.8%

        \[\leadsto \frac{0.5}{\frac{1 \cdot y}{\color{blue}{x \cdot x}}} \]
      3. times-frac57.8%

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1}{x} \cdot \frac{y}{x}}} \]
    6. Applied egg-rr57.8%

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1 \cdot \frac{y}{x}}{x}}} \]
      2. *-lft-identity57.8%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{x}} \]
    8. Simplified57.8%

      \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{y}{x}}{x}}} \]
    9. Step-by-step derivation
      1. associate-/l/57.8%

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

        \[\leadsto \frac{0.5}{\frac{y}{\color{blue}{{x}^{2}}}} \]
      3. associate-/r/57.8%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      4. metadata-eval57.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{y} \cdot {x}^{2} \]
      5. metadata-eval57.8%

        \[\leadsto \frac{\frac{1}{\color{blue}{{2}^{1}}}}{y} \cdot {x}^{2} \]
      6. metadata-eval57.8%

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

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

        \[\leadsto \color{blue}{\frac{1}{{\left(\sqrt{2}\right)}^{2} \cdot y}} \cdot {x}^{2} \]
      9. *-commutative57.5%

        \[\leadsto \frac{1}{\color{blue}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \cdot {x}^{2} \]
      10. *-commutative57.5%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \]
      11. unpow257.5%

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

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{1}{y \cdot {\left(\sqrt{2}\right)}^{2}}\right)} \]
      13. *-commutative57.6%

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

        \[\leadsto x \cdot \left(x \cdot \color{blue}{\frac{\frac{1}{{\left(\sqrt{2}\right)}^{2}}}{y}}\right) \]
      15. sqrt-pow257.9%

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{0.5}{y}\right)} \]
    11. Step-by-step derivation
      1. *-commutative57.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot x}{\frac{y}{x}}} \]
    12. Applied egg-rr57.9%

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

    if -1.69999999999999991e-114 < y < -5.40000000000000029e-226 or 4e-255 < y < 1.06e-67

    1. Initial program 90.7%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{z}{\frac{1}{\frac{z}{y}}}} \cdot -0.5 \]
      2. clear-num58.7%

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

        \[\leadsto \color{blue}{\frac{z \cdot -0.5}{\frac{y}{z}}} \]
    8. Applied egg-rr58.7%

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

    if -5.40000000000000029e-226 < y < 4e-255

    1. Initial program 87.7%

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity77.3%

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

        \[\leadsto \frac{0.5}{\frac{1 \cdot y}{\color{blue}{x \cdot x}}} \]
      3. times-frac80.1%

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

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1 \cdot \frac{y}{x}}{x}}} \]
      2. *-lft-identity80.2%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{x}} \]
    8. Simplified80.2%

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{y}{x \cdot x}}} \cdot 0.5 \]
      4. unpow274.9%

        \[\leadsto \frac{1}{\frac{y}{\color{blue}{{x}^{2}}}} \cdot 0.5 \]
      5. clear-num75.0%

        \[\leadsto \color{blue}{\frac{{x}^{2}}{y}} \cdot 0.5 \]
      6. metadata-eval75.0%

        \[\leadsto \frac{{x}^{2}}{y} \cdot \color{blue}{\frac{1}{2}} \]
      7. metadata-eval75.0%

        \[\leadsto \frac{{x}^{2}}{y} \cdot \frac{1}{\color{blue}{{2}^{1}}} \]
      8. metadata-eval75.0%

        \[\leadsto \frac{{x}^{2}}{y} \cdot \frac{1}{{2}^{\color{blue}{\left(\frac{2}{2}\right)}}} \]
      9. sqrt-pow274.7%

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

        \[\leadsto \color{blue}{\frac{\frac{{x}^{2}}{y}}{{\left(\sqrt{2}\right)}^{2}}} \]
      11. associate-/r*77.1%

        \[\leadsto \color{blue}{\frac{{x}^{2}}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \]
      12. unpow277.1%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot {\left(\sqrt{2}\right)}^{2}} \]
      13. times-frac80.0%

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

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

        \[\leadsto \frac{x}{y} \cdot \frac{x}{{2}^{\color{blue}{1}}} \]
      16. metadata-eval80.3%

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

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

    if 1.06e-67 < y < 5.5000000000000003e-8

    1. Initial program 91.4%

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

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified52.2%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity52.2%

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

        \[\leadsto \frac{0.5}{\frac{1 \cdot y}{\color{blue}{x \cdot x}}} \]
      3. times-frac52.0%

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1}{x} \cdot \frac{y}{x}}} \]
    6. Applied egg-rr52.0%

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1 \cdot \frac{y}{x}}{x}}} \]
      2. *-lft-identity52.0%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{x}} \]
    8. Simplified52.0%

      \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{y}{x}}{x}}} \]
    9. Step-by-step derivation
      1. associate-/l/52.2%

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

        \[\leadsto \frac{0.5}{\frac{y}{\color{blue}{{x}^{2}}}} \]
      3. associate-/r/51.9%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      4. metadata-eval51.9%

        \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{y} \cdot {x}^{2} \]
      5. metadata-eval51.9%

        \[\leadsto \frac{\frac{1}{\color{blue}{{2}^{1}}}}{y} \cdot {x}^{2} \]
      6. metadata-eval51.9%

        \[\leadsto \frac{\frac{1}{{2}^{\color{blue}{\left(\frac{2}{2}\right)}}}}{y} \cdot {x}^{2} \]
      7. sqrt-pow251.6%

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

        \[\leadsto \color{blue}{\frac{1}{{\left(\sqrt{2}\right)}^{2} \cdot y}} \cdot {x}^{2} \]
      9. *-commutative51.6%

        \[\leadsto \frac{1}{\color{blue}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \cdot {x}^{2} \]
      10. *-commutative51.6%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \]
      11. unpow251.6%

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

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{1}{y \cdot {\left(\sqrt{2}\right)}^{2}}\right)} \]
      13. *-commutative51.6%

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

        \[\leadsto x \cdot \left(x \cdot \color{blue}{\frac{\frac{1}{{\left(\sqrt{2}\right)}^{2}}}{y}}\right) \]
      15. sqrt-pow252.2%

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

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

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

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

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

    if 5.5000000000000003e-8 < y < 3e10

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.6 \cdot 10^{+101}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-114}:\\ \;\;\;\;\frac{x \cdot 0.5}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq -5.4 \cdot 10^{-226}:\\ \;\;\;\;\frac{z \cdot -0.5}{\frac{y}{z}}\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-255}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{-67}:\\ \;\;\;\;\frac{z \cdot -0.5}{\frac{y}{z}}\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-8}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 30000000000:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]

Alternative 5: 85.3% accurate, 0.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.29999999999999989e149 or 1.35000000000000003e154 < y

    1. Initial program 10.9%

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

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

    if -1.29999999999999989e149 < y < 1.35000000000000003e154

    1. Initial program 90.4%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.7%

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

Alternative 6: 93.0% accurate, 0.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 6.5000000000000001e214

    1. Initial program 72.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \left(y - \color{blue}{\frac{z}{1} \cdot \frac{z}{y}}\right) + 0.5 \cdot \left(\frac{x}{1} \cdot \frac{x}{y}\right) \]
    7. Step-by-step derivation
      1. /-rgt-identity94.0%

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

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

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

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

    if 6.5000000000000001e214 < x

    1. Initial program 63.1%

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity87.0%

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

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

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

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1 \cdot \frac{y}{x}}{x}}} \]
      2. *-lft-identity95.2%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{x}} \]
    8. Simplified95.2%

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{y}{x \cdot x}}} \cdot 0.5 \]
      4. unpow287.0%

        \[\leadsto \frac{1}{\frac{y}{\color{blue}{{x}^{2}}}} \cdot 0.5 \]
      5. clear-num87.0%

        \[\leadsto \color{blue}{\frac{{x}^{2}}{y}} \cdot 0.5 \]
      6. metadata-eval87.0%

        \[\leadsto \frac{{x}^{2}}{y} \cdot \color{blue}{\frac{1}{2}} \]
      7. metadata-eval87.0%

        \[\leadsto \frac{{x}^{2}}{y} \cdot \frac{1}{\color{blue}{{2}^{1}}} \]
      8. metadata-eval87.0%

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

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

        \[\leadsto \color{blue}{\frac{\frac{{x}^{2}}{y}}{{\left(\sqrt{2}\right)}^{2}}} \]
      11. associate-/r*87.0%

        \[\leadsto \color{blue}{\frac{{x}^{2}}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \]
      12. unpow287.0%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot {\left(\sqrt{2}\right)}^{2}} \]
      13. times-frac95.0%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{{\left(\sqrt{2}\right)}^{2}}} \]
      14. sqrt-pow295.2%

        \[\leadsto \frac{x}{y} \cdot \frac{x}{\color{blue}{{2}^{\left(\frac{2}{2}\right)}}} \]
      15. metadata-eval95.2%

        \[\leadsto \frac{x}{y} \cdot \frac{x}{{2}^{\color{blue}{1}}} \]
      16. metadata-eval95.2%

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

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

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

Alternative 7: 52.9% accurate, 1.3× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.05e101 or 2.15e12 < y

    1. Initial program 35.8%

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

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

    if -1.05e101 < y < 2.15e12

    1. Initial program 91.1%

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

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified49.6%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity49.6%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{1 \cdot y}}{{x}^{2}}} \]
      2. unpow249.6%

        \[\leadsto \frac{0.5}{\frac{1 \cdot y}{\color{blue}{x \cdot x}}} \]
      3. times-frac51.3%

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1}{x} \cdot \frac{y}{x}}} \]
    6. Applied egg-rr51.3%

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1 \cdot \frac{y}{x}}{x}}} \]
      2. *-lft-identity51.3%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{x}} \]
    8. Simplified51.3%

      \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{y}{x}}{x}}} \]
    9. Step-by-step derivation
      1. associate-/l/49.6%

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

        \[\leadsto \frac{0.5}{\frac{y}{\color{blue}{{x}^{2}}}} \]
      3. associate-/r/49.6%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      4. metadata-eval49.6%

        \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{y} \cdot {x}^{2} \]
      5. metadata-eval49.6%

        \[\leadsto \frac{\frac{1}{\color{blue}{{2}^{1}}}}{y} \cdot {x}^{2} \]
      6. metadata-eval49.6%

        \[\leadsto \frac{\frac{1}{{2}^{\color{blue}{\left(\frac{2}{2}\right)}}}}{y} \cdot {x}^{2} \]
      7. sqrt-pow249.4%

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

        \[\leadsto \color{blue}{\frac{1}{{\left(\sqrt{2}\right)}^{2} \cdot y}} \cdot {x}^{2} \]
      9. *-commutative49.4%

        \[\leadsto \frac{1}{\color{blue}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \cdot {x}^{2} \]
      10. *-commutative49.4%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \]
      11. unpow249.4%

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

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{1}{y \cdot {\left(\sqrt{2}\right)}^{2}}\right)} \]
      13. *-commutative51.0%

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

        \[\leadsto x \cdot \left(x \cdot \color{blue}{\frac{\frac{1}{{\left(\sqrt{2}\right)}^{2}}}{y}}\right) \]
      15. sqrt-pow251.3%

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

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

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

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

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

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

Alternative 8: 52.8% accurate, 1.3× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.1999999999999999e101 or 1.7e12 < y

    1. Initial program 34.3%

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

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

    if -8.1999999999999999e101 < y < 1.7e12

    1. Initial program 91.2%

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

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified49.6%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity49.6%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{1 \cdot y}}{{x}^{2}}} \]
      2. unpow249.6%

        \[\leadsto \frac{0.5}{\frac{1 \cdot y}{\color{blue}{x \cdot x}}} \]
      3. times-frac51.3%

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1}{x} \cdot \frac{y}{x}}} \]
    6. Applied egg-rr51.3%

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{1 \cdot \frac{y}{x}}{x}}} \]
      2. *-lft-identity51.3%

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{x}} \]
    8. Simplified51.3%

      \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{y}{x}}{x}}} \]
    9. Step-by-step derivation
      1. associate-/l/49.6%

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

        \[\leadsto \frac{0.5}{\frac{y}{\color{blue}{{x}^{2}}}} \]
      3. associate-/r/49.6%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      4. metadata-eval49.6%

        \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{y} \cdot {x}^{2} \]
      5. metadata-eval49.6%

        \[\leadsto \frac{\frac{1}{\color{blue}{{2}^{1}}}}{y} \cdot {x}^{2} \]
      6. metadata-eval49.6%

        \[\leadsto \frac{\frac{1}{{2}^{\color{blue}{\left(\frac{2}{2}\right)}}}}{y} \cdot {x}^{2} \]
      7. sqrt-pow249.4%

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

        \[\leadsto \color{blue}{\frac{1}{{\left(\sqrt{2}\right)}^{2} \cdot y}} \cdot {x}^{2} \]
      9. *-commutative49.4%

        \[\leadsto \frac{1}{\color{blue}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \cdot {x}^{2} \]
      10. *-commutative49.4%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{y \cdot {\left(\sqrt{2}\right)}^{2}}} \]
      11. unpow249.4%

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

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{1}{y \cdot {\left(\sqrt{2}\right)}^{2}}\right)} \]
      13. *-commutative51.0%

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

        \[\leadsto x \cdot \left(x \cdot \color{blue}{\frac{\frac{1}{{\left(\sqrt{2}\right)}^{2}}}{y}}\right) \]
      15. sqrt-pow251.3%

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{0.5}{y}\right)} \]
    11. Step-by-step derivation
      1. *-commutative51.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot x}{\frac{y}{x}}} \]
    12. Applied egg-rr51.3%

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

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

Alternative 9: 34.2% accurate, 5.0× speedup?

\[\begin{array}{l} x = |x|\\ \\ 0.5 \cdot y \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z) :precision binary64 (* 0.5 y))
x = abs(x);
double code(double x, double y, double z) {
	return 0.5 * y;
}
NOTE: x should be positive before calling this function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = 0.5d0 * y
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
	return 0.5 * y;
}
x = abs(x)
def code(x, y, z):
	return 0.5 * y
x = abs(x)
function code(x, y, z)
	return Float64(0.5 * y)
end
x = abs(x)
function tmp = code(x, y, z)
	tmp = 0.5 * y;
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := N[(0.5 * y), $MachinePrecision]
\begin{array}{l}
x = |x|\\
\\
0.5 \cdot y
\end{array}
Derivation
  1. Initial program 72.1%

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

    \[\leadsto \color{blue}{0.5 \cdot y} \]
  3. Final simplification33.1%

    \[\leadsto 0.5 \cdot y \]

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