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

Percentage Accurate: 68.4% → 99.9%
Time: 15.2s
Alternatives: 12
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 68.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.2× speedup?

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

\\
0.5 \cdot \left(y + \frac{z + x}{\frac{y}{x - z}}\right)
\end{array}
Derivation
  1. Initial program 71.1%

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-sqr-sqrt71.1%

      \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}{y \cdot 2} \]
    2. difference-of-squares73.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 48.3% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;y \leq 2.4 \cdot 10^{-44}:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 5.8e-200 or 3.99999999999999966e-145 < y < 2.40000000000000009e-44

    1. Initial program 76.8%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt76.8%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}{y \cdot 2} \]
      2. difference-of-squares79.6%

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \frac{z + x}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    9. Step-by-step derivation
      1. associate-*r/40.3%

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

        \[\leadsto 0.5 \cdot \frac{z + x}{\frac{\color{blue}{-y}}{z}} \]
    10. Simplified40.3%

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

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

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

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

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

    if 5.8e-200 < y < 3.99999999999999966e-145

    1. Initial program 89.5%

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

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

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{y \cdot 2}} \]
      2. *-commutative43.1%

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

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

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

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

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

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

    if 2.40000000000000009e-44 < y < 3.0000000000000001e94

    1. Initial program 91.1%

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

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

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

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

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

    if 3.0000000000000001e94 < y

    1. Initial program 36.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 5.8 \cdot 10^{-200}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z + x}{y}\right)\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-145}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-44}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z + x}{y}\right)\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+94}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 48.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.05 \cdot 10^{-199}:\\
\;\;\;\;-0.5 \cdot \frac{z}{\frac{y}{z + x}}\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < 1.05000000000000001e-199

    1. Initial program 74.6%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt74.6%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}{y \cdot 2} \]
      2. difference-of-squares77.0%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{z + x}}{\frac{y}{x - z}} \]
    7. Simplified67.8%

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

      \[\leadsto 0.5 \cdot \frac{z + x}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    9. Step-by-step derivation
      1. associate-*r/39.2%

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

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

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

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

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

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

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

    if 1.05000000000000001e-199 < y < 1.1e-146

    1. Initial program 89.5%

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

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

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{y \cdot 2}} \]
      2. *-commutative43.1%

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

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

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

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

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

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

    if 1.1e-146 < y < 3.1999999999999999e-47

    1. Initial program 94.4%

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

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}{y \cdot 2} \]
      2. difference-of-squares99.7%

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \frac{z + x}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    9. Step-by-step derivation
      1. associate-*r/49.0%

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

        \[\leadsto 0.5 \cdot \frac{z + x}{\frac{\color{blue}{-y}}{z}} \]
    10. Simplified49.0%

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

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

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

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

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

    if 3.1999999999999999e-47 < y < 4.00000000000000017e93

    1. Initial program 91.1%

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

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

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

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

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

    if 4.00000000000000017e93 < y

    1. Initial program 36.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.05 \cdot 10^{-199}:\\ \;\;\;\;-0.5 \cdot \frac{z}{\frac{y}{z + x}}\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-146}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-47}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z + x}{y}\right)\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+93}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 45.2% accurate, 0.6× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < 3.69999999999999999e-199

    1. Initial program 74.6%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt74.6%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}{y \cdot 2} \]
      2. difference-of-squares77.0%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{z + x}}{\frac{y}{x - z}} \]
    7. Simplified67.8%

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

      \[\leadsto 0.5 \cdot \frac{z + x}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    9. Step-by-step derivation
      1. associate-*r/39.2%

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

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

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

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

    if 3.69999999999999999e-199 < y < 1.45000000000000005e-146

    1. Initial program 89.5%

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

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

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{y \cdot 2}} \]
      2. *-commutative43.1%

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

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

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

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

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

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

    if 1.45000000000000005e-146 < y < 5.99999999999999975e-46

    1. Initial program 94.4%

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

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}{y \cdot 2} \]
      2. difference-of-squares99.7%

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \frac{z + x}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    9. Step-by-step derivation
      1. associate-*r/49.0%

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

        \[\leadsto 0.5 \cdot \frac{z + x}{\frac{\color{blue}{-y}}{z}} \]
    10. Simplified49.0%

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

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

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

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

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

    if 5.99999999999999975e-46 < y < 2.5000000000000001e93

    1. Initial program 91.1%

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

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

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

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

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

    if 2.5000000000000001e93 < y

    1. Initial program 36.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.7 \cdot 10^{-199}:\\ \;\;\;\;-0.5 \cdot \frac{z \cdot \left(z + x\right)}{y}\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-146}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-46}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{z + x}{y}\right)\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{+93}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 43.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.1 \cdot 10^{-264}:\\
\;\;\;\;\frac{x}{2 \cdot \frac{y}{x}}\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 3.1000000000000002e-264

    1. Initial program 73.1%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
    6. Step-by-step derivation
      1. clear-num34.4%

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

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

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

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

    if 3.1000000000000002e-264 < y < 1.7499999999999999e-241

    1. Initial program 100.0%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt100.0%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}{y \cdot 2} \]
      2. difference-of-squares100.0%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{z + x}}{\frac{y}{x - z}} \]
    7. Simplified100.0%

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

      \[\leadsto 0.5 \cdot \frac{z + x}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    9. Step-by-step derivation
      1. associate-*r/100.0%

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

        \[\leadsto 0.5 \cdot \frac{z + x}{\frac{\color{blue}{-y}}{z}} \]
    10. Simplified100.0%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-1 \cdot \frac{x \cdot z}{y}\right)} \]
    12. Step-by-step derivation
      1. mul-1-neg27.2%

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

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

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

    if 1.7499999999999999e-241 < y < 2.3000000000000002e93

    1. Initial program 91.1%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{2}} \]
    5. Applied egg-rr42.9%

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

    if 2.3000000000000002e93 < y

    1. Initial program 36.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.1 \cdot 10^{-264}:\\ \;\;\;\;\frac{x}{2 \cdot \frac{y}{x}}\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-241}:\\ \;\;\;\;0.5 \cdot \frac{-x}{\frac{y}{z}}\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+93}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 42.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.2 \cdot 10^{-48}:\\
\;\;\;\;\frac{\frac{y + z}{\frac{-y}{z}}}{2}\\

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

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


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

    1. Initial program 78.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} \cdot \frac{0.5}{y} - {z}^{2} \cdot \frac{0.5}{y}} \]
      2. distribute-rgt-out--78.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y + z}{\frac{y}{y - z}}}}{2} \]
    11. Simplified65.8%

      \[\leadsto \frac{\color{blue}{\frac{y + z}{\frac{y}{y - z}}}}{2} \]
    12. Taylor expanded in y around 0 37.9%

      \[\leadsto \frac{\frac{y + z}{\color{blue}{-1 \cdot \frac{y}{z}}}}{2} \]
    13. Step-by-step derivation
      1. associate-*r/37.9%

        \[\leadsto \frac{\frac{y + z}{\color{blue}{\frac{-1 \cdot y}{z}}}}{2} \]
      2. mul-1-neg37.9%

        \[\leadsto \frac{\frac{y + z}{\frac{\color{blue}{-y}}{z}}}{2} \]
    14. Simplified37.9%

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

    if 9.2000000000000003e-48 < y < 3.30000000000000009e93

    1. Initial program 91.1%

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

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

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

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

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

    if 3.30000000000000009e93 < y

    1. Initial program 36.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 9.2 \cdot 10^{-48}:\\ \;\;\;\;\frac{\frac{y + z}{\frac{-y}{z}}}{2}\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{+93}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 69.7% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.09999999999999991e94

    1. Initial program 79.4%

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

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

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

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

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

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

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

    if 3.09999999999999991e94 < y

    1. Initial program 36.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.1 \cdot 10^{+94}:\\ \;\;\;\;0.5 \cdot \frac{\left(z + x\right) \cdot \left(x - z\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 72.6% accurate, 0.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y + z}{\frac{y}{y - z}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.25e51

    1. Initial program 79.4%

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

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}{y \cdot 2} \]
      2. difference-of-squares82.2%

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

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

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

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

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

    if 2.25e51 < y

    1. Initial program 43.7%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt43.7%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{y + z}{\frac{y}{y - z}}} \]
    7. Simplified83.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.25 \cdot 10^{+51}:\\ \;\;\;\;0.5 \cdot \frac{\left(z + x\right) \cdot \left(x - z\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y + z}{\frac{y}{y - z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 75.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.85 \cdot 10^{+97}:\\
\;\;\;\;0.5 \cdot \frac{z + x}{\frac{y}{x - z}}\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y + z}{\frac{y}{y - z}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.8500000000000001e97

    1. Initial program 79.6%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt79.6%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}{y \cdot 2} \]
      2. difference-of-squares82.3%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{z + x}}{\frac{y}{x - z}} \]
    7. Simplified70.6%

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

    if 2.8500000000000001e97 < y

    1. Initial program 33.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt33.3%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}{y \cdot 2} \]
      2. difference-of-squares34.2%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{y + z}{\frac{y}{y - z}}} \]
    7. Simplified89.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.85 \cdot 10^{+97}:\\ \;\;\;\;0.5 \cdot \frac{z + x}{\frac{y}{x - z}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y + z}{\frac{y}{y - z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 43.8% accurate, 1.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.6e93

    1. Initial program 79.4%

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

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

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{y \cdot 2}} \]
      2. *-commutative34.2%

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

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

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

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

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

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

    if 2.6e93 < y

    1. Initial program 36.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.6 \cdot 10^{+93}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 43.8% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.1 \cdot 10^{+93}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.10000000000000019e93

    1. Initial program 79.4%

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

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

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

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

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

    if 3.10000000000000019e93 < y

    1. Initial program 36.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.1 \cdot 10^{+93}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 34.6% accurate, 5.0× speedup?

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

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

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

    \[\leadsto \color{blue}{0.5 \cdot y} \]
  4. Final simplification40.0%

    \[\leadsto 0.5 \cdot y \]
  5. Add Preprocessing

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