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

Percentage Accurate: 69.3% → 96.9%
Time: 8.8s
Alternatives: 14
Speedup: 1.4×

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 14 alternatives:

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

Initial Program: 69.3% 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: 96.9% accurate, 0.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-133} \lor \neg \left(y \leq 3 \cdot 10^{-230}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{hypot}\left(x, y\right)}{y}, \frac{\mathsf{hypot}\left(x, y\right)}{2}, \frac{z}{y} \cdot \frac{-z}{2}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x - z} \cdot \frac{2}{x + z}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.00000000000000038e-133 or 3e-230 < y

    1. Initial program 62.4%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{hypot}\left(x, y\right)}}{y}, \frac{\sqrt{x \cdot x + y \cdot y}}{2}, -\frac{z \cdot z}{y \cdot 2}\right) \]
      7. hypot-def88.2%

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{hypot}\left(x, y\right)}{y}, \frac{\color{blue}{\mathsf{hypot}\left(x, y\right)}}{2}, -\frac{z \cdot z}{y \cdot 2}\right) \]
      8. times-frac98.4%

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

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

    if -6.00000000000000038e-133 < y < 3e-230

    1. Initial program 93.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{y \cdot 2}{x \cdot x - z \cdot z}}} \]
      2. inv-pow91.2%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{2 \cdot y}{x \cdot x - z \cdot z}}} \]
      3. *-commutative91.2%

        \[\leadsto \frac{1}{\frac{\color{blue}{y \cdot 2}}{x \cdot x - z \cdot z}} \]
      4. difference-of-squares93.2%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6 \cdot 10^{-133} \lor \neg \left(y \leq 3 \cdot 10^{-230}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{hypot}\left(x, y\right)}{y}, \frac{\mathsf{hypot}\left(x, y\right)}{2}, \frac{z}{y} \cdot \frac{-z}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y}{x - z} \cdot \frac{2}{x + z}}\\ \end{array} \]

Alternative 2: 94.6% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.18 \cdot 10^{+45} \lor \neg \left(y \leq 2.2 \cdot 10^{-217}\right):\\
\;\;\;\;0.5 \cdot \left(\frac{x}{\frac{y}{x}} + \left(y - \frac{z}{\frac{y}{z}}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.17999999999999993e45 or 2.19999999999999982e-217 < y

    1. Initial program 53.7%

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

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

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

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

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

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

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

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

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

    if -1.17999999999999993e45 < y < 2.19999999999999982e-217

    1. Initial program 95.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.18 \cdot 10^{+45} \lor \neg \left(y \leq 2.2 \cdot 10^{-217}\right):\\ \;\;\;\;0.5 \cdot \left(\frac{x}{\frac{y}{x}} + \left(y - \frac{z}{\frac{y}{z}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, x, \left(y + z\right) \cdot \left(y - z\right)\right)}{y \cdot 2}\\ \end{array} \]

Alternative 3: 52.5% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+17}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;z \cdot z \leq 10^{+73}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \cdot z \leq 10^{+218}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+250}:\\
\;\;\;\;y \cdot 0.5\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (*.f64 z z) < 5e17 or 1.00000000000000008e218 < (*.f64 z z) < 5.0000000000000002e250

    1. Initial program 70.8%

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

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

    if 5e17 < (*.f64 z z) < 9.99999999999999983e72 or 9.9999999999999995e195 < (*.f64 z z) < 1.00000000000000008e218

    1. Initial program 94.1%

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

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

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

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

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

    if 9.99999999999999983e72 < (*.f64 z z) < 9.9999999999999995e195

    1. Initial program 87.8%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{hypot}\left(x, y\right)}}{y}, \frac{\sqrt{x \cdot x + y \cdot y}}{2}, -\frac{z \cdot z}{y \cdot 2}\right) \]
      7. hypot-def78.1%

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{hypot}\left(x, y\right)}{y}, \frac{\color{blue}{\mathsf{hypot}\left(x, y\right)}}{2}, -\frac{z \cdot z}{y \cdot 2}\right) \]
      8. times-frac78.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000002e250 < (*.f64 z z) < 2.0000000000000001e256

    1. Initial program 77.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
      2. div-inv100.0%

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

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

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

    if 2.0000000000000001e256 < (*.f64 z z)

    1. Initial program 51.1%

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

        \[\leadsto \color{blue}{\frac{x \cdot x + y \cdot y}{y \cdot 2} - \frac{z \cdot z}{y \cdot 2}} \]
      2. sub-neg42.7%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{hypot}\left(x, y\right)}}{y}, \frac{\sqrt{x \cdot x + y \cdot y}}{2}, -\frac{z \cdot z}{y \cdot 2}\right) \]
      7. hypot-def61.7%

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{hypot}\left(x, y\right)}{y}, \frac{\color{blue}{\mathsf{hypot}\left(x, y\right)}}{2}, -\frac{z \cdot z}{y \cdot 2}\right) \]
      8. times-frac91.5%

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

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

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

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

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

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

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

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

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

Alternative 4: 44.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\ t_1 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{if}\;z \leq 4.4 \cdot 10^{-272}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-226}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 10^{-181}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-155}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1300000000000:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+36}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+99}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{+109}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{+125}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+128}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (* z (/ -0.5 y)))) (t_1 (* 0.5 (/ x (/ y x)))))
   (if (<= z 4.4e-272)
     (* y 0.5)
     (if (<= z 4.8e-226)
       t_1
       (if (<= z 1e-181)
         (* y 0.5)
         (if (<= z 2e-155)
           t_1
           (if (<= z 1300000000000.0)
             (* y 0.5)
             (if (<= z 2.8e+36)
               t_1
               (if (<= z 5.6e+99)
                 t_0
                 (if (<= z 1.3e+109)
                   t_1
                   (if (<= z 5.4e+125)
                     (* y 0.5)
                     (if (<= z 1.35e+128) t_1 t_0))))))))))))
double code(double x, double y, double z) {
	double t_0 = z * (z * (-0.5 / y));
	double t_1 = 0.5 * (x / (y / x));
	double tmp;
	if (z <= 4.4e-272) {
		tmp = y * 0.5;
	} else if (z <= 4.8e-226) {
		tmp = t_1;
	} else if (z <= 1e-181) {
		tmp = y * 0.5;
	} else if (z <= 2e-155) {
		tmp = t_1;
	} else if (z <= 1300000000000.0) {
		tmp = y * 0.5;
	} else if (z <= 2.8e+36) {
		tmp = t_1;
	} else if (z <= 5.6e+99) {
		tmp = t_0;
	} else if (z <= 1.3e+109) {
		tmp = t_1;
	} else if (z <= 5.4e+125) {
		tmp = y * 0.5;
	} else if (z <= 1.35e+128) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = z * (z * ((-0.5d0) / y))
    t_1 = 0.5d0 * (x / (y / x))
    if (z <= 4.4d-272) then
        tmp = y * 0.5d0
    else if (z <= 4.8d-226) then
        tmp = t_1
    else if (z <= 1d-181) then
        tmp = y * 0.5d0
    else if (z <= 2d-155) then
        tmp = t_1
    else if (z <= 1300000000000.0d0) then
        tmp = y * 0.5d0
    else if (z <= 2.8d+36) then
        tmp = t_1
    else if (z <= 5.6d+99) then
        tmp = t_0
    else if (z <= 1.3d+109) then
        tmp = t_1
    else if (z <= 5.4d+125) then
        tmp = y * 0.5d0
    else if (z <= 1.35d+128) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * (z * (-0.5 / y));
	double t_1 = 0.5 * (x / (y / x));
	double tmp;
	if (z <= 4.4e-272) {
		tmp = y * 0.5;
	} else if (z <= 4.8e-226) {
		tmp = t_1;
	} else if (z <= 1e-181) {
		tmp = y * 0.5;
	} else if (z <= 2e-155) {
		tmp = t_1;
	} else if (z <= 1300000000000.0) {
		tmp = y * 0.5;
	} else if (z <= 2.8e+36) {
		tmp = t_1;
	} else if (z <= 5.6e+99) {
		tmp = t_0;
	} else if (z <= 1.3e+109) {
		tmp = t_1;
	} else if (z <= 5.4e+125) {
		tmp = y * 0.5;
	} else if (z <= 1.35e+128) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (z * (-0.5 / y))
	t_1 = 0.5 * (x / (y / x))
	tmp = 0
	if z <= 4.4e-272:
		tmp = y * 0.5
	elif z <= 4.8e-226:
		tmp = t_1
	elif z <= 1e-181:
		tmp = y * 0.5
	elif z <= 2e-155:
		tmp = t_1
	elif z <= 1300000000000.0:
		tmp = y * 0.5
	elif z <= 2.8e+36:
		tmp = t_1
	elif z <= 5.6e+99:
		tmp = t_0
	elif z <= 1.3e+109:
		tmp = t_1
	elif z <= 5.4e+125:
		tmp = y * 0.5
	elif z <= 1.35e+128:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(z * Float64(-0.5 / y)))
	t_1 = Float64(0.5 * Float64(x / Float64(y / x)))
	tmp = 0.0
	if (z <= 4.4e-272)
		tmp = Float64(y * 0.5);
	elseif (z <= 4.8e-226)
		tmp = t_1;
	elseif (z <= 1e-181)
		tmp = Float64(y * 0.5);
	elseif (z <= 2e-155)
		tmp = t_1;
	elseif (z <= 1300000000000.0)
		tmp = Float64(y * 0.5);
	elseif (z <= 2.8e+36)
		tmp = t_1;
	elseif (z <= 5.6e+99)
		tmp = t_0;
	elseif (z <= 1.3e+109)
		tmp = t_1;
	elseif (z <= 5.4e+125)
		tmp = Float64(y * 0.5);
	elseif (z <= 1.35e+128)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (z * (-0.5 / y));
	t_1 = 0.5 * (x / (y / x));
	tmp = 0.0;
	if (z <= 4.4e-272)
		tmp = y * 0.5;
	elseif (z <= 4.8e-226)
		tmp = t_1;
	elseif (z <= 1e-181)
		tmp = y * 0.5;
	elseif (z <= 2e-155)
		tmp = t_1;
	elseif (z <= 1300000000000.0)
		tmp = y * 0.5;
	elseif (z <= 2.8e+36)
		tmp = t_1;
	elseif (z <= 5.6e+99)
		tmp = t_0;
	elseif (z <= 1.3e+109)
		tmp = t_1;
	elseif (z <= 5.4e+125)
		tmp = y * 0.5;
	elseif (z <= 1.35e+128)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(z * N[(-0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 4.4e-272], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 4.8e-226], t$95$1, If[LessEqual[z, 1e-181], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 2e-155], t$95$1, If[LessEqual[z, 1300000000000.0], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 2.8e+36], t$95$1, If[LessEqual[z, 5.6e+99], t$95$0, If[LessEqual[z, 1.3e+109], t$95$1, If[LessEqual[z, 5.4e+125], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 1.35e+128], t$95$1, t$95$0]]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 4.8 \cdot 10^{-226}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 10^{-181}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;z \leq 2 \cdot 10^{-155}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1300000000000:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;z \leq 2.8 \cdot 10^{+36}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 5.6 \cdot 10^{+99}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 1.3 \cdot 10^{+109}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 5.4 \cdot 10^{+125}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;z \leq 1.35 \cdot 10^{+128}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 4.39999999999999976e-272 or 4.7999999999999999e-226 < z < 1.00000000000000005e-181 or 2.00000000000000003e-155 < z < 1.3e12 or 1.2999999999999999e109 < z < 5.3999999999999997e125

    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 45.6%

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

    if 4.39999999999999976e-272 < z < 4.7999999999999999e-226 or 1.00000000000000005e-181 < z < 2.00000000000000003e-155 or 1.3e12 < z < 2.8000000000000001e36 or 5.6e99 < z < 1.2999999999999999e109 or 5.3999999999999997e125 < z < 1.35000000000000001e128

    1. Initial program 74.1%

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

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

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

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

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

    if 2.8000000000000001e36 < z < 5.6e99 or 1.35000000000000001e128 < z

    1. Initial program 62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 4.4 \cdot 10^{-272}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-226}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 10^{-181}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-155}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 1300000000000:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+36}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+99}:\\ \;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{+109}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{+125}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+128}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\ \end{array} \]

Alternative 5: 44.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\ t_1 := \frac{x}{y} \cdot \left(x \cdot 0.5\right)\\ t_2 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{if}\;z \leq 9.2 \cdot 10^{-272}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-226}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-180}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-155}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1300000000000:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+37}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+99}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+109}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{+126}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+128}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (* z (/ -0.5 y))))
        (t_1 (* (/ x y) (* x 0.5)))
        (t_2 (* 0.5 (/ x (/ y x)))))
   (if (<= z 9.2e-272)
     (* y 0.5)
     (if (<= z 5.4e-226)
       t_2
       (if (<= z 1.6e-180)
         (* y 0.5)
         (if (<= z 6.5e-155)
           t_1
           (if (<= z 1300000000000.0)
             (* y 0.5)
             (if (<= z 1.9e+37)
               t_2
               (if (<= z 5.6e+99)
                 t_0
                 (if (<= z 1.8e+109)
                   t_2
                   (if (<= z 1.7e+126)
                     (* y 0.5)
                     (if (<= z 1.35e+128) t_1 t_0))))))))))))
double code(double x, double y, double z) {
	double t_0 = z * (z * (-0.5 / y));
	double t_1 = (x / y) * (x * 0.5);
	double t_2 = 0.5 * (x / (y / x));
	double tmp;
	if (z <= 9.2e-272) {
		tmp = y * 0.5;
	} else if (z <= 5.4e-226) {
		tmp = t_2;
	} else if (z <= 1.6e-180) {
		tmp = y * 0.5;
	} else if (z <= 6.5e-155) {
		tmp = t_1;
	} else if (z <= 1300000000000.0) {
		tmp = y * 0.5;
	} else if (z <= 1.9e+37) {
		tmp = t_2;
	} else if (z <= 5.6e+99) {
		tmp = t_0;
	} else if (z <= 1.8e+109) {
		tmp = t_2;
	} else if (z <= 1.7e+126) {
		tmp = y * 0.5;
	} else if (z <= 1.35e+128) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = z * (z * ((-0.5d0) / y))
    t_1 = (x / y) * (x * 0.5d0)
    t_2 = 0.5d0 * (x / (y / x))
    if (z <= 9.2d-272) then
        tmp = y * 0.5d0
    else if (z <= 5.4d-226) then
        tmp = t_2
    else if (z <= 1.6d-180) then
        tmp = y * 0.5d0
    else if (z <= 6.5d-155) then
        tmp = t_1
    else if (z <= 1300000000000.0d0) then
        tmp = y * 0.5d0
    else if (z <= 1.9d+37) then
        tmp = t_2
    else if (z <= 5.6d+99) then
        tmp = t_0
    else if (z <= 1.8d+109) then
        tmp = t_2
    else if (z <= 1.7d+126) then
        tmp = y * 0.5d0
    else if (z <= 1.35d+128) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * (z * (-0.5 / y));
	double t_1 = (x / y) * (x * 0.5);
	double t_2 = 0.5 * (x / (y / x));
	double tmp;
	if (z <= 9.2e-272) {
		tmp = y * 0.5;
	} else if (z <= 5.4e-226) {
		tmp = t_2;
	} else if (z <= 1.6e-180) {
		tmp = y * 0.5;
	} else if (z <= 6.5e-155) {
		tmp = t_1;
	} else if (z <= 1300000000000.0) {
		tmp = y * 0.5;
	} else if (z <= 1.9e+37) {
		tmp = t_2;
	} else if (z <= 5.6e+99) {
		tmp = t_0;
	} else if (z <= 1.8e+109) {
		tmp = t_2;
	} else if (z <= 1.7e+126) {
		tmp = y * 0.5;
	} else if (z <= 1.35e+128) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (z * (-0.5 / y))
	t_1 = (x / y) * (x * 0.5)
	t_2 = 0.5 * (x / (y / x))
	tmp = 0
	if z <= 9.2e-272:
		tmp = y * 0.5
	elif z <= 5.4e-226:
		tmp = t_2
	elif z <= 1.6e-180:
		tmp = y * 0.5
	elif z <= 6.5e-155:
		tmp = t_1
	elif z <= 1300000000000.0:
		tmp = y * 0.5
	elif z <= 1.9e+37:
		tmp = t_2
	elif z <= 5.6e+99:
		tmp = t_0
	elif z <= 1.8e+109:
		tmp = t_2
	elif z <= 1.7e+126:
		tmp = y * 0.5
	elif z <= 1.35e+128:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(z * Float64(-0.5 / y)))
	t_1 = Float64(Float64(x / y) * Float64(x * 0.5))
	t_2 = Float64(0.5 * Float64(x / Float64(y / x)))
	tmp = 0.0
	if (z <= 9.2e-272)
		tmp = Float64(y * 0.5);
	elseif (z <= 5.4e-226)
		tmp = t_2;
	elseif (z <= 1.6e-180)
		tmp = Float64(y * 0.5);
	elseif (z <= 6.5e-155)
		tmp = t_1;
	elseif (z <= 1300000000000.0)
		tmp = Float64(y * 0.5);
	elseif (z <= 1.9e+37)
		tmp = t_2;
	elseif (z <= 5.6e+99)
		tmp = t_0;
	elseif (z <= 1.8e+109)
		tmp = t_2;
	elseif (z <= 1.7e+126)
		tmp = Float64(y * 0.5);
	elseif (z <= 1.35e+128)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (z * (-0.5 / y));
	t_1 = (x / y) * (x * 0.5);
	t_2 = 0.5 * (x / (y / x));
	tmp = 0.0;
	if (z <= 9.2e-272)
		tmp = y * 0.5;
	elseif (z <= 5.4e-226)
		tmp = t_2;
	elseif (z <= 1.6e-180)
		tmp = y * 0.5;
	elseif (z <= 6.5e-155)
		tmp = t_1;
	elseif (z <= 1300000000000.0)
		tmp = y * 0.5;
	elseif (z <= 1.9e+37)
		tmp = t_2;
	elseif (z <= 5.6e+99)
		tmp = t_0;
	elseif (z <= 1.8e+109)
		tmp = t_2;
	elseif (z <= 1.7e+126)
		tmp = y * 0.5;
	elseif (z <= 1.35e+128)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(z * N[(-0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 9.2e-272], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 5.4e-226], t$95$2, If[LessEqual[z, 1.6e-180], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 6.5e-155], t$95$1, If[LessEqual[z, 1300000000000.0], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 1.9e+37], t$95$2, If[LessEqual[z, 5.6e+99], t$95$0, If[LessEqual[z, 1.8e+109], t$95$2, If[LessEqual[z, 1.7e+126], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 1.35e+128], t$95$1, t$95$0]]]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 5.4 \cdot 10^{-226}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 1.6 \cdot 10^{-180}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-155}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1300000000000:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;z \leq 1.9 \cdot 10^{+37}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 5.6 \cdot 10^{+99}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{+109}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 1.7 \cdot 10^{+126}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;z \leq 1.35 \cdot 10^{+128}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < 9.19999999999999955e-272 or 5.40000000000000029e-226 < z < 1.60000000000000008e-180 or 6.5e-155 < z < 1.3e12 or 1.8e109 < z < 1.69999999999999995e126

    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 45.6%

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

    if 9.19999999999999955e-272 < z < 5.40000000000000029e-226 or 1.3e12 < z < 1.89999999999999995e37 or 5.6e99 < z < 1.8e109

    1. Initial program 83.4%

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

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

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

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

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

    if 1.60000000000000008e-180 < z < 6.5e-155 or 1.69999999999999995e126 < z < 1.35000000000000001e128

    1. Initial program 59.7%

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

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

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

      \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 2} \]
    5. Step-by-step derivation
      1. times-frac58.8%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
      2. div-inv58.8%

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

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

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

    if 1.89999999999999995e37 < z < 5.6e99 or 1.35000000000000001e128 < z

    1. Initial program 62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 9.2 \cdot 10^{-272}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-226}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-180}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-155}:\\ \;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\ \mathbf{elif}\;z \leq 1300000000000:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+37}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+99}:\\ \;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+109}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{+126}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+128}:\\ \;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\ \end{array} \]

Alternative 6: 93.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{+43} \lor \neg \left(y \leq 6.4 \cdot 10^{-223}\right):\\ \;\;\;\;0.5 \cdot \left(\frac{x}{\frac{y}{x}} + \left(y - \frac{z}{\frac{y}{z}}\right)\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 -7e+43) (not (<= y 6.4e-223)))
   (* 0.5 (+ (/ x (/ y x)) (- y (/ z (/ y z)))))
   (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -7e+43) || !(y <= 6.4e-223)) {
		tmp = 0.5 * ((x / (y / x)) + (y - (z / (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 <= (-7d+43)) .or. (.not. (y <= 6.4d-223))) then
        tmp = 0.5d0 * ((x / (y / x)) + (y - (z / (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 <= -7e+43) || !(y <= 6.4e-223)) {
		tmp = 0.5 * ((x / (y / x)) + (y - (z / (y / z))));
	} else {
		tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -7e+43) or not (y <= 6.4e-223):
		tmp = 0.5 * ((x / (y / x)) + (y - (z / (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 <= -7e+43) || !(y <= 6.4e-223))
		tmp = Float64(0.5 * Float64(Float64(x / Float64(y / x)) + Float64(y - Float64(z / 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 <= -7e+43) || ~((y <= 6.4e-223)))
		tmp = 0.5 * ((x / (y / x)) + (y - (z / (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, -7e+43], N[Not[LessEqual[y, 6.4e-223]], $MachinePrecision]], N[(0.5 * N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] + N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -7 \cdot 10^{+43} \lor \neg \left(y \leq 6.4 \cdot 10^{-223}\right):\\
\;\;\;\;0.5 \cdot \left(\frac{x}{\frac{y}{x}} + \left(y - \frac{z}{\frac{y}{z}}\right)\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 < -7.0000000000000002e43 or 6.4000000000000001e-223 < y

    1. Initial program 53.7%

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

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

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

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

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

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

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

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

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

    if -7.0000000000000002e43 < y < 6.4000000000000001e-223

    1. Initial program 95.0%

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

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

Alternative 7: 94.1% accurate, 0.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x - z} \cdot \frac{2}{x + z}}\\


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

    1. Initial program 72.1%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 88.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. +-commutative88.6%

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

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

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

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

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

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

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

    if 5.00000000000000022e263 < (*.f64 x x)

    1. Initial program 57.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{y \cdot 2}{x \cdot x - z \cdot z}}} \]
      2. inv-pow57.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{2 \cdot y}{x \cdot x - z \cdot z}}} \]
      3. *-commutative57.7%

        \[\leadsto \frac{1}{\frac{\color{blue}{y \cdot 2}}{x \cdot x - z \cdot z}} \]
      4. difference-of-squares77.5%

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{y}{x - z} \cdot \frac{2}{x + z}}} \]
      7. +-commutative83.9%

        \[\leadsto \frac{1}{\frac{y}{x - z} \cdot \frac{2}{\color{blue}{z + x}}} \]
    8. Simplified83.9%

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

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

Alternative 8: 85.6% accurate, 0.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x - z} \cdot \frac{2}{x + z}}\\


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

    1. Initial program 72.7%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{y + z}{\frac{y}{y - z}}} \]
      5. associate-/r/90.2%

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

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

    if 3.9999999999999996e131 < (*.f64 x x)

    1. Initial program 61.6%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{y \cdot 2}{x \cdot x - z \cdot z}}} \]
      2. inv-pow59.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{2 \cdot y}{x \cdot x - z \cdot z}}} \]
      3. *-commutative59.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{y \cdot 2}}{x \cdot x - z \cdot z}} \]
      4. difference-of-squares72.5%

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{y}{x - z} \cdot \frac{2}{x + z}}} \]
      7. +-commutative76.8%

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

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

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

Alternative 9: 80.8% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;y \leq 8 \cdot 10^{-45}:\\
\;\;\;\;\frac{x \cdot x - z \cdot z}{y \cdot 2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.80000000000000015e-26

    1. Initial program 45.3%

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

        \[\leadsto \color{blue}{\frac{x \cdot x + y \cdot y}{y \cdot 2} - \frac{z \cdot z}{y \cdot 2}} \]
      2. sub-neg45.3%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{hypot}\left(x, y\right)}}{y}, \frac{\sqrt{x \cdot x + y \cdot y}}{2}, -\frac{z \cdot z}{y \cdot 2}\right) \]
      7. hypot-def82.1%

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{hypot}\left(x, y\right)}{y}, \frac{\color{blue}{\mathsf{hypot}\left(x, y\right)}}{2}, -\frac{z \cdot z}{y \cdot 2}\right) \]
      8. times-frac98.7%

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{hypot}\left(x, y\right)}{y}, \frac{\mathsf{hypot}\left(x, y\right)}{2}, -\color{blue}{\frac{z}{y} \cdot \frac{z}{2}}\right) \]
    3. Applied egg-rr98.7%

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

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

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

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

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

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

    if -3.80000000000000015e-26 < y < 7.99999999999999987e-45

    1. Initial program 91.9%

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

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

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

        \[\leadsto \frac{x \cdot x - \color{blue}{z \cdot z}}{y \cdot 2} \]
    4. Simplified84.6%

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

    if 7.99999999999999987e-45 < y

    1. Initial program 60.9%

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

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

        \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{2}}{y} + 0.5 \cdot \left(y - \frac{{z}^{2}}{y}\right)} \]
      2. distribute-lft-out82.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 74.1% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

    if 2.6000000000000002e163 < x

    1. Initial program 52.1%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
      2. div-inv80.5%

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

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

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

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

Alternative 11: 74.1% accurate, 1.4× speedup?

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

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

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


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

    1. Initial program 69.7%

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

        \[\leadsto \color{blue}{\frac{x \cdot x + y \cdot y}{y \cdot 2} - \frac{z \cdot z}{y \cdot 2}} \]
      2. sub-neg63.8%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{hypot}\left(x, y\right)}{y}, \frac{\color{blue}{\mathsf{hypot}\left(x, y\right)}}{2}, -\frac{z \cdot z}{y \cdot 2}\right) \]
      8. times-frac94.4%

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

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

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

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

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

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

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

    if 4.39999999999999973e163 < x

    1. Initial program 52.1%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
      2. div-inv80.5%

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

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

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

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

Alternative 12: 74.1% accurate, 1.4× speedup?

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

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

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


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

    1. Initial program 69.7%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 79.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. +-commutative79.6%

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

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

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

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

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

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

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

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

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

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

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

    if 3.9999999999999998e163 < x

    1. Initial program 52.1%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
      2. div-inv80.5%

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

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

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

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

Alternative 13: 43.7% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 69.7%

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

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

    if 5.0000000000000004e68 < x

    1. Initial program 62.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5 \cdot 10^{+68}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \end{array} \]

Alternative 14: 34.5% accurate, 5.0× speedup?

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

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

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

    \[\leadsto \color{blue}{0.5 \cdot y} \]
  3. Final simplification40.9%

    \[\leadsto y \cdot 0.5 \]

Developer target: 99.9% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2023293 
(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)))