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

Percentage Accurate: 68.5% → 90.1%
Time: 14.7s
Alternatives: 11
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 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: 68.5% 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: 90.1% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{+173} \lor \neg \left(y \leq 3.5 \cdot 10^{+162}\right):\\ \;\;\;\;\frac{z + y}{y \cdot 2} \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(z + y, y - z, x \cdot x\right)}{y \cdot 2}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -4.2e+173) (not (<= y 3.5e+162)))
   (* (/ (+ z y) (* y 2.0)) (- y z))
   (/ (fma (+ z y) (- y z) (* x x)) (* y 2.0))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -4.2e+173) || !(y <= 3.5e+162)) {
		tmp = ((z + y) / (y * 2.0)) * (y - z);
	} else {
		tmp = fma((z + y), (y - z), (x * x)) / (y * 2.0);
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if ((y <= -4.2e+173) || !(y <= 3.5e+162))
		tmp = Float64(Float64(Float64(z + y) / Float64(y * 2.0)) * Float64(y - z));
	else
		tmp = Float64(fma(Float64(z + y), Float64(y - z), Float64(x * x)) / Float64(y * 2.0));
	end
	return tmp
end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.2e+173], N[Not[LessEqual[y, 3.5e+162]], $MachinePrecision]], N[(N[(N[(z + y), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z + y), $MachinePrecision] * N[(y - z), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+173} \lor \neg \left(y \leq 3.5 \cdot 10^{+162}\right):\\
\;\;\;\;\frac{z + y}{y \cdot 2} \cdot \left(y - z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.2e173 or 3.50000000000000018e162 < y

    1. Initial program 5.2%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + z, y + \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      9. sub-neg12.4%

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y + z, y - z, x \cdot x\right)}{y \cdot 2}} \]
    4. Taylor expanded in x around 0 12.3%

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

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

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

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

    if -4.2e173 < y < 3.50000000000000018e162

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + z, y + \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      9. sub-neg89.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{+173} \lor \neg \left(y \leq 3.5 \cdot 10^{+162}\right):\\ \;\;\;\;\frac{z + y}{y \cdot 2} \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(z + y, y - z, x \cdot x\right)}{y \cdot 2}\\ \end{array} \]

Alternative 2: 85.1% accurate, 0.0× speedup?

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

\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right)\\
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+129}:\\
\;\;\;\;t_0 \cdot \left(\frac{0.5}{y} \cdot t_0\right)\\

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


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

    1. Initial program 77.2%

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{y} \cdot \left(\color{blue}{{\left(\sqrt{x \cdot x + y \cdot y}\right)}^{2}} - z \cdot z\right) \]
      8. hypot-def77.1%

        \[\leadsto \frac{0.5}{y} \cdot \left({\color{blue}{\left(\mathsf{hypot}\left(x, y\right)\right)}}^{2} - z \cdot z\right) \]
      9. pow277.1%

        \[\leadsto \frac{0.5}{y} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - \color{blue}{{z}^{2}}\right) \]
    3. Applied egg-rr77.1%

      \[\leadsto \color{blue}{\frac{0.5}{y} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)} \]
    4. Step-by-step derivation
      1. clear-num77.1%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{0.5}}} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right) \]
      2. metadata-eval77.1%

        \[\leadsto \frac{\color{blue}{\frac{2}{2}}}{\frac{y}{0.5}} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right) \]
      3. associate-*l/77.2%

        \[\leadsto \color{blue}{\frac{\frac{2}{2} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)}{\frac{y}{0.5}}} \]
      4. div-inv77.2%

        \[\leadsto \frac{\frac{2}{2} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)}{\color{blue}{y \cdot \frac{1}{0.5}}} \]
      5. metadata-eval77.2%

        \[\leadsto \frac{\frac{2}{2} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)}{y \cdot \color{blue}{2}} \]
      6. associate-/l*77.1%

        \[\leadsto \color{blue}{\frac{\frac{2}{2}}{\frac{y \cdot 2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
      7. div-inv77.1%

        \[\leadsto \frac{\frac{2}{2}}{\color{blue}{\left(y \cdot 2\right) \cdot \frac{1}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
      8. associate-/r*77.1%

        \[\leadsto \color{blue}{\frac{\frac{\frac{2}{2}}{y \cdot 2}}{\frac{1}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
      9. metadata-eval77.1%

        \[\leadsto \frac{\frac{\color{blue}{1}}{y \cdot 2}}{\frac{1}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}} \]
      10. metadata-eval77.1%

        \[\leadsto \frac{\frac{1}{y \cdot \color{blue}{\frac{1}{0.5}}}}{\frac{1}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}} \]
      11. div-inv77.1%

        \[\leadsto \frac{\frac{1}{\color{blue}{\frac{y}{0.5}}}}{\frac{1}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}} \]
      12. clear-num77.1%

        \[\leadsto \frac{\color{blue}{\frac{0.5}{y}}}{\frac{1}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}} \]
    5. Applied egg-rr77.1%

      \[\leadsto \color{blue}{\frac{\frac{0.5}{y}}{\frac{1}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
    6. Step-by-step derivation
      1. associate-/r/77.1%

        \[\leadsto \color{blue}{\frac{\frac{0.5}{y}}{1} \cdot \left({\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}\right)} \]
      2. add-sqr-sqrt70.0%

        \[\leadsto \frac{\frac{0.5}{y}}{1} \cdot \color{blue}{\left(\sqrt{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}} \cdot \sqrt{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}\right)} \]
      3. associate-*r*70.1%

        \[\leadsto \color{blue}{\left(\frac{\frac{0.5}{y}}{1} \cdot \sqrt{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}\right) \cdot \sqrt{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}} \]
    7. Applied egg-rr92.1%

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

    if 2e129 < (*.f64 z z)

    1. Initial program 56.3%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + z, y + \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      9. sub-neg65.5%

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y + z, y - z, x \cdot x\right)}{y \cdot 2}} \]
    4. Taylor expanded in x around 0 63.4%

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

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

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

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

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

Alternative 3: 87.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.65 \cdot 10^{+36} \lor \neg \left(y \leq 3.5 \cdot 10^{+162}\right):\\ \;\;\;\;\frac{z + y}{y \cdot 2} \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, x, y \cdot y\right) - z \cdot z}{y \cdot 2}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -2.65e+36) (not (<= y 3.5e+162)))
   (* (/ (+ z y) (* y 2.0)) (- y z))
   (/ (- (fma x x (* y y)) (* z z)) (* y 2.0))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -2.65e+36) || !(y <= 3.5e+162)) {
		tmp = ((z + y) / (y * 2.0)) * (y - z);
	} else {
		tmp = (fma(x, x, (y * y)) - (z * z)) / (y * 2.0);
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if ((y <= -2.65e+36) || !(y <= 3.5e+162))
		tmp = Float64(Float64(Float64(z + y) / Float64(y * 2.0)) * Float64(y - z));
	else
		tmp = Float64(Float64(fma(x, x, Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0));
	end
	return tmp
end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.65e+36], N[Not[LessEqual[y, 3.5e+162]], $MachinePrecision]], N[(N[(N[(z + y), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * x + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.65 \cdot 10^{+36} \lor \neg \left(y \leq 3.5 \cdot 10^{+162}\right):\\
\;\;\;\;\frac{z + y}{y \cdot 2} \cdot \left(y - z\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, 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 < -2.65e36 or 3.50000000000000018e162 < y

    1. Initial program 30.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y + z, y - z, x \cdot x\right)}{y \cdot 2}} \]
    4. Taylor expanded in x around 0 35.5%

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

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

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

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

    if -2.65e36 < y < 3.50000000000000018e162

    1. Initial program 88.9%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.65 \cdot 10^{+36} \lor \neg \left(y \leq 3.5 \cdot 10^{+162}\right):\\ \;\;\;\;\frac{z + y}{y \cdot 2} \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, x, y \cdot y\right) - z \cdot z}{y \cdot 2}\\ \end{array} \]

Alternative 4: 73.6% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;x \leq 6.8 \cdot 10^{+111}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 9 \cdot 10^{+119}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 5.3 \cdot 10^{+129}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 5.5 \cdot 10^{+182}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 1.05 \cdot 10^{+195}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < 1.85000000000000003e57 or 3.69999999999999992e86 < x < 6.8000000000000003e111 or 9.00000000000000039e119 < x < 5.2999999999999999e129 or 5.49999999999999977e182 < x < 1.05000000000000005e195

    1. Initial program 69.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y + z, y - z, x \cdot x\right)}{y \cdot 2}} \]
    4. Taylor expanded in x around 0 54.1%

      \[\leadsto \frac{\color{blue}{\left(y + z\right) \cdot \left(y - z\right)}}{y \cdot 2} \]
    5. Step-by-step derivation
      1. div-inv54.0%

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

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

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

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

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

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

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

    if 1.85000000000000003e57 < x < 3.69999999999999992e86

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto x \cdot \left(x \cdot \frac{1}{y \cdot \color{blue}{\frac{1}{0.5}}}\right) \]
      5. div-inv75.0%

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

        \[\leadsto x \cdot \left(x \cdot \color{blue}{\frac{0.5}{y}}\right) \]
    4. Applied egg-rr75.0%

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

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

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

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

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

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

    if 6.8000000000000003e111 < x < 9.00000000000000039e119 or 5.2999999999999999e129 < x < 5.49999999999999977e182

    1. Initial program 68.7%

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

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

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

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

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

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

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

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

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

    if 1.05000000000000005e195 < x

    1. Initial program 59.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{y}{x \cdot 0.5}}} \]
      6. *-un-lft-identity84.8%

        \[\leadsto \frac{x}{\frac{\color{blue}{1 \cdot y}}{x \cdot 0.5}} \]
      7. *-commutative84.8%

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

        \[\leadsto \frac{x}{\color{blue}{\frac{1}{0.5} \cdot \frac{y}{x}}} \]
      9. metadata-eval84.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.85 \cdot 10^{+57}:\\ \;\;\;\;\left(y - z\right) \cdot \left(\frac{0.5}{y} \cdot \left(z + y\right)\right)\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{+86}:\\ \;\;\;\;\frac{x \cdot \left(0.5 \cdot x\right)}{y}\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{+111}:\\ \;\;\;\;\left(y - z\right) \cdot \left(\frac{0.5}{y} \cdot \left(z + y\right)\right)\\ \mathbf{elif}\;x \leq 9 \cdot 10^{+119}:\\ \;\;\;\;x \cdot \left(\frac{0.5}{y} \cdot x\right)\\ \mathbf{elif}\;x \leq 5.3 \cdot 10^{+129}:\\ \;\;\;\;\left(y - z\right) \cdot \left(\frac{0.5}{y} \cdot \left(z + y\right)\right)\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{+182}:\\ \;\;\;\;x \cdot \left(\frac{0.5}{y} \cdot x\right)\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{+195}:\\ \;\;\;\;\left(y - z\right) \cdot \left(\frac{0.5}{y} \cdot \left(z + y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 \cdot \frac{y}{x}}\\ \end{array} \]

Alternative 5: 73.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{z + y}{y \cdot 2} \cdot \left(y - z\right)\\ t_1 := \left(y - z\right) \cdot \left(\frac{0.5}{y} \cdot \left(z + y\right)\right)\\ t_2 := x \cdot \left(\frac{0.5}{y} \cdot x\right)\\ \mathbf{if}\;x \leq 1.95 \cdot 10^{+57}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{+86}:\\ \;\;\;\;\frac{x \cdot \left(0.5 \cdot x\right)}{y}\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{+111}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{+119}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{+130}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.35 \cdot 10^{+182}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 10^{+195}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 \cdot \frac{y}{x}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (/ (+ z y) (* y 2.0)) (- y z)))
        (t_1 (* (- y z) (* (/ 0.5 y) (+ z y))))
        (t_2 (* x (* (/ 0.5 y) x))))
   (if (<= x 1.95e+57)
     t_0
     (if (<= x 1.9e+86)
       (/ (* x (* 0.5 x)) y)
       (if (<= x 4.5e+111)
         t_1
         (if (<= x 2.8e+119)
           t_2
           (if (<= x 4.4e+130)
             t_1
             (if (<= x 2.35e+182)
               t_2
               (if (<= x 1e+195) t_0 (/ x (* 2.0 (/ y x))))))))))))
double code(double x, double y, double z) {
	double t_0 = ((z + y) / (y * 2.0)) * (y - z);
	double t_1 = (y - z) * ((0.5 / y) * (z + y));
	double t_2 = x * ((0.5 / y) * x);
	double tmp;
	if (x <= 1.95e+57) {
		tmp = t_0;
	} else if (x <= 1.9e+86) {
		tmp = (x * (0.5 * x)) / y;
	} else if (x <= 4.5e+111) {
		tmp = t_1;
	} else if (x <= 2.8e+119) {
		tmp = t_2;
	} else if (x <= 4.4e+130) {
		tmp = t_1;
	} else if (x <= 2.35e+182) {
		tmp = t_2;
	} else if (x <= 1e+195) {
		tmp = t_0;
	} else {
		tmp = x / (2.0 * (y / x));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = ((z + y) / (y * 2.0d0)) * (y - z)
    t_1 = (y - z) * ((0.5d0 / y) * (z + y))
    t_2 = x * ((0.5d0 / y) * x)
    if (x <= 1.95d+57) then
        tmp = t_0
    else if (x <= 1.9d+86) then
        tmp = (x * (0.5d0 * x)) / y
    else if (x <= 4.5d+111) then
        tmp = t_1
    else if (x <= 2.8d+119) then
        tmp = t_2
    else if (x <= 4.4d+130) then
        tmp = t_1
    else if (x <= 2.35d+182) then
        tmp = t_2
    else if (x <= 1d+195) then
        tmp = t_0
    else
        tmp = x / (2.0d0 * (y / x))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = ((z + y) / (y * 2.0)) * (y - z);
	double t_1 = (y - z) * ((0.5 / y) * (z + y));
	double t_2 = x * ((0.5 / y) * x);
	double tmp;
	if (x <= 1.95e+57) {
		tmp = t_0;
	} else if (x <= 1.9e+86) {
		tmp = (x * (0.5 * x)) / y;
	} else if (x <= 4.5e+111) {
		tmp = t_1;
	} else if (x <= 2.8e+119) {
		tmp = t_2;
	} else if (x <= 4.4e+130) {
		tmp = t_1;
	} else if (x <= 2.35e+182) {
		tmp = t_2;
	} else if (x <= 1e+195) {
		tmp = t_0;
	} else {
		tmp = x / (2.0 * (y / x));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = ((z + y) / (y * 2.0)) * (y - z)
	t_1 = (y - z) * ((0.5 / y) * (z + y))
	t_2 = x * ((0.5 / y) * x)
	tmp = 0
	if x <= 1.95e+57:
		tmp = t_0
	elif x <= 1.9e+86:
		tmp = (x * (0.5 * x)) / y
	elif x <= 4.5e+111:
		tmp = t_1
	elif x <= 2.8e+119:
		tmp = t_2
	elif x <= 4.4e+130:
		tmp = t_1
	elif x <= 2.35e+182:
		tmp = t_2
	elif x <= 1e+195:
		tmp = t_0
	else:
		tmp = x / (2.0 * (y / x))
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(Float64(z + y) / Float64(y * 2.0)) * Float64(y - z))
	t_1 = Float64(Float64(y - z) * Float64(Float64(0.5 / y) * Float64(z + y)))
	t_2 = Float64(x * Float64(Float64(0.5 / y) * x))
	tmp = 0.0
	if (x <= 1.95e+57)
		tmp = t_0;
	elseif (x <= 1.9e+86)
		tmp = Float64(Float64(x * Float64(0.5 * x)) / y);
	elseif (x <= 4.5e+111)
		tmp = t_1;
	elseif (x <= 2.8e+119)
		tmp = t_2;
	elseif (x <= 4.4e+130)
		tmp = t_1;
	elseif (x <= 2.35e+182)
		tmp = t_2;
	elseif (x <= 1e+195)
		tmp = t_0;
	else
		tmp = Float64(x / Float64(2.0 * Float64(y / x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = ((z + y) / (y * 2.0)) * (y - z);
	t_1 = (y - z) * ((0.5 / y) * (z + y));
	t_2 = x * ((0.5 / y) * x);
	tmp = 0.0;
	if (x <= 1.95e+57)
		tmp = t_0;
	elseif (x <= 1.9e+86)
		tmp = (x * (0.5 * x)) / y;
	elseif (x <= 4.5e+111)
		tmp = t_1;
	elseif (x <= 2.8e+119)
		tmp = t_2;
	elseif (x <= 4.4e+130)
		tmp = t_1;
	elseif (x <= 2.35e+182)
		tmp = t_2;
	elseif (x <= 1e+195)
		tmp = t_0;
	else
		tmp = x / (2.0 * (y / x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(z + y), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(N[(0.5 / y), $MachinePrecision] * N[(z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(0.5 / y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.95e+57], t$95$0, If[LessEqual[x, 1.9e+86], N[(N[(x * N[(0.5 * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 4.5e+111], t$95$1, If[LessEqual[x, 2.8e+119], t$95$2, If[LessEqual[x, 4.4e+130], t$95$1, If[LessEqual[x, 2.35e+182], t$95$2, If[LessEqual[x, 1e+195], t$95$0, N[(x / N[(2.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \leq 4.5 \cdot 10^{+111}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 2.8 \cdot 10^{+119}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 4.4 \cdot 10^{+130}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 2.35 \cdot 10^{+182}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 10^{+195}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < 1.94999999999999984e57 or 2.34999999999999992e182 < x < 9.99999999999999977e194

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + z, y + \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      9. sub-neg72.8%

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y + z, y - z, x \cdot x\right)}{y \cdot 2}} \]
    4. Taylor expanded in x around 0 53.7%

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

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

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

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

    if 1.94999999999999984e57 < x < 1.89999999999999989e86

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto x \cdot \left(x \cdot \frac{1}{y \cdot \color{blue}{\frac{1}{0.5}}}\right) \]
      5. div-inv75.0%

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

        \[\leadsto x \cdot \left(x \cdot \color{blue}{\frac{0.5}{y}}\right) \]
    4. Applied egg-rr75.0%

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

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

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

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

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

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

    if 1.89999999999999989e86 < x < 4.50000000000000001e111 or 2.80000000000000013e119 < x < 4.39999999999999987e130

    1. Initial program 62.5%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y + z, y + \left(-z\right), x \cdot x\right)}}{y \cdot 2} \]
      9. sub-neg77.4%

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y + z, y - z, x \cdot x\right)}{y \cdot 2}} \]
    4. Taylor expanded in x around 0 65.2%

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

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

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

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

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

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

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

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

    if 4.50000000000000001e111 < x < 2.80000000000000013e119 or 4.39999999999999987e130 < x < 2.34999999999999992e182

    1. Initial program 68.7%

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

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

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

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

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

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

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

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

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

    if 9.99999999999999977e194 < x

    1. Initial program 59.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{y}{x \cdot 0.5}}} \]
      6. *-un-lft-identity84.8%

        \[\leadsto \frac{x}{\frac{\color{blue}{1 \cdot y}}{x \cdot 0.5}} \]
      7. *-commutative84.8%

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

        \[\leadsto \frac{x}{\color{blue}{\frac{1}{0.5} \cdot \frac{y}{x}}} \]
      9. metadata-eval84.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.95 \cdot 10^{+57}:\\ \;\;\;\;\frac{z + y}{y \cdot 2} \cdot \left(y - z\right)\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{+86}:\\ \;\;\;\;\frac{x \cdot \left(0.5 \cdot x\right)}{y}\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{+111}:\\ \;\;\;\;\left(y - z\right) \cdot \left(\frac{0.5}{y} \cdot \left(z + y\right)\right)\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{+119}:\\ \;\;\;\;x \cdot \left(\frac{0.5}{y} \cdot x\right)\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{+130}:\\ \;\;\;\;\left(y - z\right) \cdot \left(\frac{0.5}{y} \cdot \left(z + y\right)\right)\\ \mathbf{elif}\;x \leq 2.35 \cdot 10^{+182}:\\ \;\;\;\;x \cdot \left(\frac{0.5}{y} \cdot x\right)\\ \mathbf{elif}\;x \leq 10^{+195}:\\ \;\;\;\;\frac{z + y}{y \cdot 2} \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 \cdot \frac{y}{x}}\\ \end{array} \]

Alternative 6: 87.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.22 \cdot 10^{+36} \lor \neg \left(y \leq 3.5 \cdot 10^{+162}\right):\\
\;\;\;\;\frac{z + y}{y \cdot 2} \cdot \left(y - z\right)\\

\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 < -2.22e36 or 3.50000000000000018e162 < y

    1. Initial program 30.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y + z, y - z, x \cdot x\right)}{y \cdot 2}} \]
    4. Taylor expanded in x around 0 35.5%

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

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

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

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

    if -2.22e36 < y < 3.50000000000000018e162

    1. Initial program 88.9%

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

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

Alternative 7: 43.2% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.6 \cdot 10^{+19} \lor \neg \left(x \leq 5.5 \cdot 10^{+182}\right) \land x \leq 10^{+195}:\\
\;\;\;\;0.5 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.6e19 or 5.49999999999999977e182 < x < 9.99999999999999977e194

    1. Initial program 68.8%

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

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

    if 1.6e19 < x < 5.49999999999999977e182 or 9.99999999999999977e194 < x

    1. Initial program 69.4%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.6 \cdot 10^{+19} \lor \neg \left(x \leq 5.5 \cdot 10^{+182}\right) \land x \leq 10^{+195}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{0.5}{y} \cdot x\right)\\ \end{array} \]

Alternative 8: 43.2% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.4 \cdot 10^{+18}:\\
\;\;\;\;0.5 \cdot y\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 8.4e18 or 5.49999999999999977e182 < x < 9.99999999999999977e194

    1. Initial program 68.8%

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

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

    if 8.4e18 < x < 5.49999999999999977e182

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

    if 9.99999999999999977e194 < x

    1. Initial program 59.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{x \cdot 0.5}{y}} \]
      2. *-commutative84.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 8.4 \cdot 10^{+18}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{+182}:\\ \;\;\;\;x \cdot \left(\frac{0.5}{y} \cdot x\right)\\ \mathbf{elif}\;x \leq 10^{+195}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{0.5}{\frac{y}{x}}\\ \end{array} \]

Alternative 9: 43.2% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.1 \cdot 10^{+18}:\\
\;\;\;\;0.5 \cdot y\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 9.1e18 or 5.49999999999999977e182 < x < 9.99999999999999977e194

    1. Initial program 68.8%

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

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

    if 9.1e18 < x < 5.49999999999999977e182

    1. Initial program 77.2%

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

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

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

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

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

    if 9.99999999999999977e194 < x

    1. Initial program 59.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{x \cdot 0.5}{y}} \]
      2. *-commutative84.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 9.1 \cdot 10^{+18}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{+182}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{elif}\;x \leq 10^{+195}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{0.5}{\frac{y}{x}}\\ \end{array} \]

Alternative 10: 43.2% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.5 \cdot 10^{+18}:\\
\;\;\;\;0.5 \cdot y\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 3.5e18 or 5.49999999999999977e182 < x < 9.99999999999999977e194

    1. Initial program 68.8%

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

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

    if 3.5e18 < x < 5.49999999999999977e182

    1. Initial program 77.2%

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

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

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

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

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

    if 9.99999999999999977e194 < x

    1. Initial program 59.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{y}{x \cdot 0.5}}} \]
      6. *-un-lft-identity84.8%

        \[\leadsto \frac{x}{\frac{\color{blue}{1 \cdot y}}{x \cdot 0.5}} \]
      7. *-commutative84.8%

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

        \[\leadsto \frac{x}{\color{blue}{\frac{1}{0.5} \cdot \frac{y}{x}}} \]
      9. metadata-eval84.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.5 \cdot 10^{+18}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{+182}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{elif}\;x \leq 10^{+195}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 \cdot \frac{y}{x}}\\ \end{array} \]

Alternative 11: 34.7% accurate, 5.0× speedup?

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

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

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

    \[\leadsto \color{blue}{0.5 \cdot y} \]
  3. Final simplification35.7%

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