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

Percentage Accurate: 68.3% → 99.8%
Time: 12.2s
Alternatives: 14
Speedup: 0.9×

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: 68.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: 99.8% accurate, 0.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z\_m}}{\mathsf{hypot}\left(y, x\right) + z\_m}} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m)
 :precision binary64
 (/ 0.5 (/ (/ y (- (hypot y x) z_m)) (+ (hypot y x) z_m))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	return 0.5 / ((y / (hypot(y, x) - z_m)) / (hypot(y, x) + z_m));
}
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	return 0.5 / ((y / (Math.hypot(y, x) - z_m)) / (Math.hypot(y, x) + z_m));
}
z_m = math.fabs(z)
def code(x, y, z_m):
	return 0.5 / ((y / (math.hypot(y, x) - z_m)) / (math.hypot(y, x) + z_m))
z_m = abs(z)
function code(x, y, z_m)
	return Float64(0.5 / Float64(Float64(y / Float64(hypot(y, x) - z_m)) / Float64(hypot(y, x) + z_m)))
end
z_m = abs(z);
function tmp = code(x, y, z_m)
	tmp = 0.5 / ((y / (hypot(y, x) - z_m)) / (hypot(y, x) + z_m));
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := N[(0.5 / N[(N[(y / N[(N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision] - z$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision] + z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|

\\
\frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z\_m}}{\mathsf{hypot}\left(y, x\right) + z\_m}}
\end{array}
Derivation
  1. Initial program 71.9%

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
    8. distribute-lft-neg-in71.9%

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

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

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

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

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

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

    \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. clear-num74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\color{blue}{\mathsf{hypot}\left(y, x\right)} - z}}{\mathsf{hypot}\left(x, y\right) + z}} \]
    10. +-commutative99.8%

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{\color{blue}{z + \mathsf{hypot}\left(x, y\right)}}} \]
    11. hypot-undefine78.5%

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \color{blue}{\sqrt{x \cdot x + y \cdot y}}}} \]
    12. unpow278.5%

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{\color{blue}{{x}^{2}} + y \cdot y}}} \]
    13. unpow278.5%

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{{x}^{2} + \color{blue}{{y}^{2}}}}} \]
    14. +-commutative78.5%

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{\color{blue}{{y}^{2} + {x}^{2}}}}} \]
    15. unpow278.5%

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{\color{blue}{y \cdot y} + {x}^{2}}}} \]
    16. unpow278.5%

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

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \color{blue}{\mathsf{hypot}\left(y, x\right)}}} \]
  10. Simplified99.8%

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

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

Alternative 2: 67.5% accurate, 0.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} t_0 := \frac{\left(x \cdot x + y \cdot y\right) - z\_m \cdot z\_m}{y \cdot 2}\\ \mathbf{if}\;t\_0 \leq 10^{-24}:\\ \;\;\;\;0.5 \cdot \left(\left(y + z\_m\right) \cdot \frac{y - z\_m}{y}\right)\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right) + z\_m}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(x + z\_m\right) \cdot \frac{x - z\_m}{y}\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m)
 :precision binary64
 (let* ((t_0 (/ (- (+ (* x x) (* y y)) (* z_m z_m)) (* y 2.0))))
   (if (<= t_0 1e-24)
     (* 0.5 (* (+ y z_m) (/ (- y z_m) y)))
     (if (<= t_0 INFINITY)
       (/ 0.5 (/ (/ y (hypot y x)) (+ (hypot y x) z_m)))
       (* 0.5 (* (+ x z_m) (/ (- x z_m) y)))))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	double t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0);
	double tmp;
	if (t_0 <= 1e-24) {
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	} else if (t_0 <= ((double) INFINITY)) {
		tmp = 0.5 / ((y / hypot(y, x)) / (hypot(y, x) + z_m));
	} else {
		tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
	}
	return tmp;
}
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	double t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0);
	double tmp;
	if (t_0 <= 1e-24) {
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	} else if (t_0 <= Double.POSITIVE_INFINITY) {
		tmp = 0.5 / ((y / Math.hypot(y, x)) / (Math.hypot(y, x) + z_m));
	} else {
		tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m):
	t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0)
	tmp = 0
	if t_0 <= 1e-24:
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y))
	elif t_0 <= math.inf:
		tmp = 0.5 / ((y / math.hypot(y, x)) / (math.hypot(y, x) + z_m))
	else:
		tmp = 0.5 * ((x + z_m) * ((x - z_m) / y))
	return tmp
z_m = abs(z)
function code(x, y, z_m)
	t_0 = Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z_m * z_m)) / Float64(y * 2.0))
	tmp = 0.0
	if (t_0 <= 1e-24)
		tmp = Float64(0.5 * Float64(Float64(y + z_m) * Float64(Float64(y - z_m) / y)));
	elseif (t_0 <= Inf)
		tmp = Float64(0.5 / Float64(Float64(y / hypot(y, x)) / Float64(hypot(y, x) + z_m)));
	else
		tmp = Float64(0.5 * Float64(Float64(x + z_m) * Float64(Float64(x - z_m) / y)));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m)
	t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0);
	tmp = 0.0;
	if (t_0 <= 1e-24)
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	elseif (t_0 <= Inf)
		tmp = 0.5 / ((y / hypot(y, x)) / (hypot(y, x) + z_m));
	else
		tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := Block[{t$95$0 = N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e-24], N[(0.5 * N[(N[(y + z$95$m), $MachinePrecision] * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(0.5 / N[(N[(y / N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision] + z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + z$95$m), $MachinePrecision] * N[(N[(x - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
t_0 := \frac{\left(x \cdot x + y \cdot y\right) - z\_m \cdot z\_m}{y \cdot 2}\\
\mathbf{if}\;t\_0 \leq 10^{-24}:\\
\;\;\;\;0.5 \cdot \left(\left(y + z\_m\right) \cdot \frac{y - z\_m}{y}\right)\\

\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right) + z\_m}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 9.99999999999999924e-25

    1. Initial program 82.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine82.2%

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

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

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

        \[\leadsto 0.5 \cdot \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} \]
      5. hypot-define82.2%

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

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

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

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

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

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

    if 9.99999999999999924e-25 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < +inf.0

    1. Initial program 78.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num77.6%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{y}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}} \]
      2. un-div-inv78.3%

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

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

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

        \[\leadsto \frac{0.5}{\frac{y}{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}} \]
      6. pow278.3%

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{1 \cdot y}{\mathsf{hypot}\left(x, y\right) \cdot \mathsf{hypot}\left(x, y\right) - \color{blue}{z \cdot z}}} \]
      4. difference-of-squares78.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\color{blue}{\mathsf{hypot}\left(y, x\right)} - z}}{\mathsf{hypot}\left(x, y\right) + z}} \]
      10. +-commutative99.8%

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{\color{blue}{{y}^{2} + {x}^{2}}}}} \]
      15. unpow279.1%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \color{blue}{\mathsf{hypot}\left(y, x\right)}}} \]
    10. Simplified99.8%

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\color{blue}{\mathsf{hypot}\left(y, x\right)}}}{z + \mathsf{hypot}\left(y, x\right)}} \]
    13. Simplified69.2%

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

    if +inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64)))

    1. Initial program 0.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out0.0%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in0.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine0.0%

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

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

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

        \[\leadsto 0.5 \cdot \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} \]
      5. hypot-define57.8%

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

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

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

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

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

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

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

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

Alternative 3: 83.8% accurate, 0.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;y \leq 3.4 \cdot 10^{+108}:\\ \;\;\;\;0.5 \cdot \frac{\left(z\_m + \mathsf{hypot}\left(x, y\right)\right) \cdot \left(\mathsf{hypot}\left(x, y\right) - z\_m\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right) + z\_m}}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m)
 :precision binary64
 (if (<= y 3.4e+108)
   (* 0.5 (/ (* (+ z_m (hypot x y)) (- (hypot x y) z_m)) y))
   (/ 0.5 (/ (/ y (hypot y x)) (+ (hypot y x) z_m)))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	double tmp;
	if (y <= 3.4e+108) {
		tmp = 0.5 * (((z_m + hypot(x, y)) * (hypot(x, y) - z_m)) / y);
	} else {
		tmp = 0.5 / ((y / hypot(y, x)) / (hypot(y, x) + z_m));
	}
	return tmp;
}
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	double tmp;
	if (y <= 3.4e+108) {
		tmp = 0.5 * (((z_m + Math.hypot(x, y)) * (Math.hypot(x, y) - z_m)) / y);
	} else {
		tmp = 0.5 / ((y / Math.hypot(y, x)) / (Math.hypot(y, x) + z_m));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m):
	tmp = 0
	if y <= 3.4e+108:
		tmp = 0.5 * (((z_m + math.hypot(x, y)) * (math.hypot(x, y) - z_m)) / y)
	else:
		tmp = 0.5 / ((y / math.hypot(y, x)) / (math.hypot(y, x) + z_m))
	return tmp
z_m = abs(z)
function code(x, y, z_m)
	tmp = 0.0
	if (y <= 3.4e+108)
		tmp = Float64(0.5 * Float64(Float64(Float64(z_m + hypot(x, y)) * Float64(hypot(x, y) - z_m)) / y));
	else
		tmp = Float64(0.5 / Float64(Float64(y / hypot(y, x)) / Float64(hypot(y, x) + z_m)));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m)
	tmp = 0.0;
	if (y <= 3.4e+108)
		tmp = 0.5 * (((z_m + hypot(x, y)) * (hypot(x, y) - z_m)) / y);
	else
		tmp = 0.5 / ((y / hypot(y, x)) / (hypot(y, x) + z_m));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := If[LessEqual[y, 3.4e+108], N[(0.5 * N[(N[(N[(z$95$m + N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision] - z$95$m), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(N[(y / N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision] + z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.4 \cdot 10^{+108}:\\
\;\;\;\;0.5 \cdot \frac{\left(z\_m + \mathsf{hypot}\left(x, y\right)\right) \cdot \left(\mathsf{hypot}\left(x, y\right) - z\_m\right)}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right) + z\_m}}\\


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

    1. Initial program 81.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out81.0%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in81.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine80.6%

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

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

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

        \[\leadsto 0.5 \cdot \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} \]
      5. hypot-define86.8%

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

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

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

    if 3.39999999999999996e108 < y

    1. Initial program 25.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num25.3%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{y}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}} \]
      2. un-div-inv25.3%

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

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

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

        \[\leadsto \frac{0.5}{\frac{y}{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}} \]
      6. pow225.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{\mathsf{hypot}\left(x, y\right) - z}}}{\mathsf{hypot}\left(x, y\right) + z}} \]
      3. hypot-undefine33.3%

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\color{blue}{\mathsf{hypot}\left(y, x\right)} - z}}{\mathsf{hypot}\left(x, y\right) + z}} \]
      10. +-commutative99.9%

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{\color{blue}{z + \mathsf{hypot}\left(x, y\right)}}} \]
      11. hypot-undefine30.9%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{{x}^{2} + \color{blue}{{y}^{2}}}}} \]
      14. +-commutative30.9%

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{\color{blue}{{y}^{2} + {x}^{2}}}}} \]
      15. unpow230.9%

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

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

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

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

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\color{blue}{\sqrt{{x}^{2} + {y}^{2}}}}}{z + \mathsf{hypot}\left(y, x\right)}} \]
    12. Step-by-step derivation
      1. +-commutative31.1%

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\sqrt{\color{blue}{{y}^{2} + {x}^{2}}}}}{z + \mathsf{hypot}\left(y, x\right)}} \]
      2. unpow231.1%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\color{blue}{\mathsf{hypot}\left(y, x\right)}}}{z + \mathsf{hypot}\left(y, x\right)}} \]
    13. Simplified94.2%

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

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

Alternative 4: 76.8% accurate, 0.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;y \leq 1.52 \cdot 10^{-130}:\\ \;\;\;\;\frac{0.5}{\frac{y}{\left(x + z\_m\right) \cdot \left(x - z\_m\right)}}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+131}:\\ \;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, x, \left(y + z\_m\right) \cdot \left(y - z\_m\right)\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(y + z\_m\right) \cdot \frac{y - z\_m}{y}\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m)
 :precision binary64
 (if (<= y 1.52e-130)
   (/ 0.5 (/ y (* (+ x z_m) (- x z_m))))
   (if (<= y 4.2e+131)
     (* 0.5 (/ (fma x x (* (+ y z_m) (- y z_m))) y))
     (* 0.5 (* (+ y z_m) (/ (- y z_m) y))))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	double tmp;
	if (y <= 1.52e-130) {
		tmp = 0.5 / (y / ((x + z_m) * (x - z_m)));
	} else if (y <= 4.2e+131) {
		tmp = 0.5 * (fma(x, x, ((y + z_m) * (y - z_m))) / y);
	} else {
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	}
	return tmp;
}
z_m = abs(z)
function code(x, y, z_m)
	tmp = 0.0
	if (y <= 1.52e-130)
		tmp = Float64(0.5 / Float64(y / Float64(Float64(x + z_m) * Float64(x - z_m))));
	elseif (y <= 4.2e+131)
		tmp = Float64(0.5 * Float64(fma(x, x, Float64(Float64(y + z_m) * Float64(y - z_m))) / y));
	else
		tmp = Float64(0.5 * Float64(Float64(y + z_m) * Float64(Float64(y - z_m) / y)));
	end
	return tmp
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := If[LessEqual[y, 1.52e-130], N[(0.5 / N[(y / N[(N[(x + z$95$m), $MachinePrecision] * N[(x - z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e+131], N[(0.5 * N[(N[(x * x + N[(N[(y + z$95$m), $MachinePrecision] * N[(y - z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y + z$95$m), $MachinePrecision] * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|

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

\mathbf{elif}\;y \leq 4.2 \cdot 10^{+131}:\\
\;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, x, \left(y + z\_m\right) \cdot \left(y - z\_m\right)\right)}{y}\\

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


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

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num80.6%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{y}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}} \]
      2. un-div-inv81.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{1 \cdot y}{\mathsf{hypot}\left(x, y\right) \cdot \mathsf{hypot}\left(x, y\right) - \color{blue}{z \cdot z}}} \]
      4. difference-of-squares85.8%

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{\mathsf{hypot}\left(x, y\right) - z}}}{\mathsf{hypot}\left(x, y\right) + z}} \]
      3. hypot-undefine84.4%

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\color{blue}{\mathsf{hypot}\left(y, x\right)} - z}}{\mathsf{hypot}\left(x, y\right) + z}} \]
      10. +-commutative99.8%

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{\color{blue}{z + \mathsf{hypot}\left(x, y\right)}}} \]
      11. hypot-undefine83.8%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{{x}^{2} + \color{blue}{{y}^{2}}}}} \]
      14. +-commutative83.8%

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{\color{blue}{{y}^{2} + {x}^{2}}}}} \]
      15. unpow283.8%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \color{blue}{\mathsf{hypot}\left(y, x\right)}}} \]
    10. Simplified99.8%

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

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

    if 1.51999999999999998e-130 < y < 4.19999999999999971e131

    1. Initial program 86.7%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out86.7%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in86.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. difference-of-squares89.8%

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

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

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

    if 4.19999999999999971e131 < y

    1. Initial program 21.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out21.0%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in21.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine21.0%

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

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

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

        \[\leadsto 0.5 \cdot \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} \]
      5. hypot-define27.5%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.52 \cdot 10^{-130}:\\ \;\;\;\;\frac{0.5}{\frac{y}{\left(x + z\right) \cdot \left(x - z\right)}}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+131}:\\ \;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, x, \left(y + z\right) \cdot \left(y - z\right)\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(y + z\right) \cdot \frac{y - z}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 86.2% accurate, 0.5× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-122}:\\ \;\;\;\;0.5 \cdot \left(\left(y + z\_m\right) \cdot \frac{y - z\_m}{y}\right)\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+265}:\\ \;\;\;\;\frac{\left(x \cdot x + y \cdot y\right) - z\_m \cdot z\_m}{y \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(x + z\_m\right) \cdot \frac{x - z\_m}{y}\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m)
 :precision binary64
 (if (<= (* x x) 5e-122)
   (* 0.5 (* (+ y z_m) (/ (- y z_m) y)))
   (if (<= (* x x) 2e+265)
     (/ (- (+ (* x x) (* y y)) (* z_m z_m)) (* y 2.0))
     (* 0.5 (* (+ x z_m) (/ (- x z_m) y))))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	double tmp;
	if ((x * x) <= 5e-122) {
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	} else if ((x * x) <= 2e+265) {
		tmp = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0);
	} else {
		tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if ((x * x) <= 5d-122) then
        tmp = 0.5d0 * ((y + z_m) * ((y - z_m) / y))
    else if ((x * x) <= 2d+265) then
        tmp = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0d0)
    else
        tmp = 0.5d0 * ((x + z_m) * ((x - z_m) / y))
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	double tmp;
	if ((x * x) <= 5e-122) {
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	} else if ((x * x) <= 2e+265) {
		tmp = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0);
	} else {
		tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m):
	tmp = 0
	if (x * x) <= 5e-122:
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y))
	elif (x * x) <= 2e+265:
		tmp = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0)
	else:
		tmp = 0.5 * ((x + z_m) * ((x - z_m) / y))
	return tmp
z_m = abs(z)
function code(x, y, z_m)
	tmp = 0.0
	if (Float64(x * x) <= 5e-122)
		tmp = Float64(0.5 * Float64(Float64(y + z_m) * Float64(Float64(y - z_m) / y)));
	elseif (Float64(x * x) <= 2e+265)
		tmp = Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z_m * z_m)) / Float64(y * 2.0));
	else
		tmp = Float64(0.5 * Float64(Float64(x + z_m) * Float64(Float64(x - z_m) / y)));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m)
	tmp = 0.0;
	if ((x * x) <= 5e-122)
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	elseif ((x * x) <= 2e+265)
		tmp = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0);
	else
		tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e-122], N[(0.5 * N[(N[(y + z$95$m), $MachinePrecision] * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 2e+265], N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + z$95$m), $MachinePrecision] * N[(N[(x - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 4.9999999999999999e-122

    1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine76.8%

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

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

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

        \[\leadsto 0.5 \cdot \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} \]
      5. hypot-define77.0%

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

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

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

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

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

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

    if 4.9999999999999999e-122 < (*.f64 x x) < 2.00000000000000013e265

    1. Initial program 82.8%

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

    if 2.00000000000000013e265 < (*.f64 x x)

    1. Initial program 52.7%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out52.7%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in52.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine52.7%

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

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

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

        \[\leadsto 0.5 \cdot \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} \]
      5. hypot-define72.7%

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

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

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

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

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

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

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

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

Alternative 6: 52.5% accurate, 0.8× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z\_m \leq 2.9 \cdot 10^{-168}:\\ \;\;\;\;\frac{0.5}{\frac{\frac{y}{x}}{x + z\_m}}\\ \mathbf{elif}\;z\_m \leq 2.3 \cdot 10^{+71}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(z\_m \cdot \frac{y - z\_m}{y}\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m)
 :precision binary64
 (if (<= z_m 2.9e-168)
   (/ 0.5 (/ (/ y x) (+ x z_m)))
   (if (<= z_m 2.3e+71) (* 0.5 y) (* 0.5 (* z_m (/ (- y z_m) y))))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	double tmp;
	if (z_m <= 2.9e-168) {
		tmp = 0.5 / ((y / x) / (x + z_m));
	} else if (z_m <= 2.3e+71) {
		tmp = 0.5 * y;
	} else {
		tmp = 0.5 * (z_m * ((y - z_m) / y));
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if (z_m <= 2.9d-168) then
        tmp = 0.5d0 / ((y / x) / (x + z_m))
    else if (z_m <= 2.3d+71) then
        tmp = 0.5d0 * y
    else
        tmp = 0.5d0 * (z_m * ((y - z_m) / y))
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	double tmp;
	if (z_m <= 2.9e-168) {
		tmp = 0.5 / ((y / x) / (x + z_m));
	} else if (z_m <= 2.3e+71) {
		tmp = 0.5 * y;
	} else {
		tmp = 0.5 * (z_m * ((y - z_m) / y));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m):
	tmp = 0
	if z_m <= 2.9e-168:
		tmp = 0.5 / ((y / x) / (x + z_m))
	elif z_m <= 2.3e+71:
		tmp = 0.5 * y
	else:
		tmp = 0.5 * (z_m * ((y - z_m) / y))
	return tmp
z_m = abs(z)
function code(x, y, z_m)
	tmp = 0.0
	if (z_m <= 2.9e-168)
		tmp = Float64(0.5 / Float64(Float64(y / x) / Float64(x + z_m)));
	elseif (z_m <= 2.3e+71)
		tmp = Float64(0.5 * y);
	else
		tmp = Float64(0.5 * Float64(z_m * Float64(Float64(y - z_m) / y)));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m)
	tmp = 0.0;
	if (z_m <= 2.9e-168)
		tmp = 0.5 / ((y / x) / (x + z_m));
	elseif (z_m <= 2.3e+71)
		tmp = 0.5 * y;
	else
		tmp = 0.5 * (z_m * ((y - z_m) / y));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := If[LessEqual[z$95$m, 2.9e-168], N[(0.5 / N[(N[(y / x), $MachinePrecision] / N[(x + z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 2.3e+71], N[(0.5 * y), $MachinePrecision], N[(0.5 * N[(z$95$m * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|

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

\mathbf{elif}\;z\_m \leq 2.3 \cdot 10^{+71}:\\
\;\;\;\;0.5 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 2.8999999999999998e-168

    1. Initial program 70.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out70.0%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in70.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num72.4%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{y}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}} \]
      2. un-div-inv72.8%

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

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

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

        \[\leadsto \frac{0.5}{\frac{y}{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}} \]
      6. pow269.9%

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{1 \cdot y}{\mathsf{hypot}\left(x, y\right) \cdot \mathsf{hypot}\left(x, y\right) - \color{blue}{z \cdot z}}} \]
      4. difference-of-squares77.8%

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{\mathsf{hypot}\left(x, y\right) - z}}}{\mathsf{hypot}\left(x, y\right) + z}} \]
      3. hypot-undefine79.4%

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\color{blue}{\mathsf{hypot}\left(y, x\right)} - z}}{\mathsf{hypot}\left(x, y\right) + z}} \]
      10. +-commutative99.8%

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{\color{blue}{z + \mathsf{hypot}\left(x, y\right)}}} \]
      11. hypot-undefine76.0%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{{x}^{2} + \color{blue}{{y}^{2}}}}} \]
      14. +-commutative76.0%

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{\color{blue}{{y}^{2} + {x}^{2}}}}} \]
      15. unpow276.0%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \color{blue}{\mathsf{hypot}\left(y, x\right)}}} \]
    10. Simplified99.8%

      \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \mathsf{hypot}\left(y, x\right)}}} \]
    11. Taylor expanded in x around inf 25.4%

      \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{z + \mathsf{hypot}\left(y, x\right)}} \]
    12. Taylor expanded in y around 0 38.3%

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{y}{x}}{x + z}}} \]
      2. +-commutative42.3%

        \[\leadsto \frac{0.5}{\frac{\frac{y}{x}}{\color{blue}{z + x}}} \]
    14. Simplified42.3%

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

    if 2.8999999999999998e-168 < z < 2.3000000000000002e71

    1. Initial program 78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 44.2%

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

    if 2.3000000000000002e71 < z

    1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine72.5%

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

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

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

        \[\leadsto 0.5 \cdot \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} \]
      5. hypot-define77.2%

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

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

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

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

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

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

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

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

Alternative 7: 51.4% accurate, 0.8× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z\_m \leq 5.6 \cdot 10^{-163}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y}\\ \mathbf{elif}\;z\_m \leq 2.7 \cdot 10^{+71}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(z\_m \cdot \frac{y - z\_m}{y}\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m)
 :precision binary64
 (if (<= z_m 5.6e-163)
   (* (* x x) (/ 0.5 y))
   (if (<= z_m 2.7e+71) (* 0.5 y) (* 0.5 (* z_m (/ (- y z_m) y))))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	double tmp;
	if (z_m <= 5.6e-163) {
		tmp = (x * x) * (0.5 / y);
	} else if (z_m <= 2.7e+71) {
		tmp = 0.5 * y;
	} else {
		tmp = 0.5 * (z_m * ((y - z_m) / y));
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if (z_m <= 5.6d-163) then
        tmp = (x * x) * (0.5d0 / y)
    else if (z_m <= 2.7d+71) then
        tmp = 0.5d0 * y
    else
        tmp = 0.5d0 * (z_m * ((y - z_m) / y))
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	double tmp;
	if (z_m <= 5.6e-163) {
		tmp = (x * x) * (0.5 / y);
	} else if (z_m <= 2.7e+71) {
		tmp = 0.5 * y;
	} else {
		tmp = 0.5 * (z_m * ((y - z_m) / y));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m):
	tmp = 0
	if z_m <= 5.6e-163:
		tmp = (x * x) * (0.5 / y)
	elif z_m <= 2.7e+71:
		tmp = 0.5 * y
	else:
		tmp = 0.5 * (z_m * ((y - z_m) / y))
	return tmp
z_m = abs(z)
function code(x, y, z_m)
	tmp = 0.0
	if (z_m <= 5.6e-163)
		tmp = Float64(Float64(x * x) * Float64(0.5 / y));
	elseif (z_m <= 2.7e+71)
		tmp = Float64(0.5 * y);
	else
		tmp = Float64(0.5 * Float64(z_m * Float64(Float64(y - z_m) / y)));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m)
	tmp = 0.0;
	if (z_m <= 5.6e-163)
		tmp = (x * x) * (0.5 / y);
	elseif (z_m <= 2.7e+71)
		tmp = 0.5 * y;
	else
		tmp = 0.5 * (z_m * ((y - z_m) / y));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := If[LessEqual[z$95$m, 5.6e-163], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 2.7e+71], N[(0.5 * y), $MachinePrecision], N[(0.5 * N[(z$95$m * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|

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

\mathbf{elif}\;z\_m \leq 2.7 \cdot 10^{+71}:\\
\;\;\;\;0.5 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 5.5999999999999999e-163

    1. Initial program 70.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out70.0%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in70.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 30.2%

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

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

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

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

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

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

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

    if 5.5999999999999999e-163 < z < 2.69999999999999997e71

    1. Initial program 78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 44.2%

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

    if 2.69999999999999997e71 < z

    1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine72.5%

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

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

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

        \[\leadsto 0.5 \cdot \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} \]
      5. hypot-define77.2%

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

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

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

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

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

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

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

Alternative 8: 51.3% accurate, 0.8× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z\_m \leq 5.6 \cdot 10^{-163}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y}\\ \mathbf{elif}\;z\_m \leq 1.8 \cdot 10^{+70}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(z\_m \cdot \frac{z\_m}{y}\right) \cdot \left(-0.5\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m)
 :precision binary64
 (if (<= z_m 5.6e-163)
   (* (* x x) (/ 0.5 y))
   (if (<= z_m 1.8e+70) (* 0.5 y) (* (* z_m (/ z_m y)) (- 0.5)))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	double tmp;
	if (z_m <= 5.6e-163) {
		tmp = (x * x) * (0.5 / y);
	} else if (z_m <= 1.8e+70) {
		tmp = 0.5 * y;
	} else {
		tmp = (z_m * (z_m / y)) * -0.5;
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if (z_m <= 5.6d-163) then
        tmp = (x * x) * (0.5d0 / y)
    else if (z_m <= 1.8d+70) then
        tmp = 0.5d0 * y
    else
        tmp = (z_m * (z_m / y)) * -0.5d0
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	double tmp;
	if (z_m <= 5.6e-163) {
		tmp = (x * x) * (0.5 / y);
	} else if (z_m <= 1.8e+70) {
		tmp = 0.5 * y;
	} else {
		tmp = (z_m * (z_m / y)) * -0.5;
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m):
	tmp = 0
	if z_m <= 5.6e-163:
		tmp = (x * x) * (0.5 / y)
	elif z_m <= 1.8e+70:
		tmp = 0.5 * y
	else:
		tmp = (z_m * (z_m / y)) * -0.5
	return tmp
z_m = abs(z)
function code(x, y, z_m)
	tmp = 0.0
	if (z_m <= 5.6e-163)
		tmp = Float64(Float64(x * x) * Float64(0.5 / y));
	elseif (z_m <= 1.8e+70)
		tmp = Float64(0.5 * y);
	else
		tmp = Float64(Float64(z_m * Float64(z_m / y)) * Float64(-0.5));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m)
	tmp = 0.0;
	if (z_m <= 5.6e-163)
		tmp = (x * x) * (0.5 / y);
	elseif (z_m <= 1.8e+70)
		tmp = 0.5 * y;
	else
		tmp = (z_m * (z_m / y)) * -0.5;
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := If[LessEqual[z$95$m, 5.6e-163], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 1.8e+70], N[(0.5 * y), $MachinePrecision], N[(N[(z$95$m * N[(z$95$m / y), $MachinePrecision]), $MachinePrecision] * (-0.5)), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|

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

\mathbf{elif}\;z\_m \leq 1.8 \cdot 10^{+70}:\\
\;\;\;\;0.5 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 5.5999999999999999e-163

    1. Initial program 70.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out70.0%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in70.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 30.2%

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

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

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

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

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

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

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

    if 5.5999999999999999e-163 < z < 1.8e70

    1. Initial program 78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 44.2%

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

    if 1.8e70 < z

    1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine72.5%

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

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

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

        \[\leadsto 0.5 \cdot \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} \]
      5. hypot-define77.2%

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(z \cdot \color{blue}{\left(-\frac{z}{y}\right)}\right) \]
      2. distribute-neg-frac276.1%

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

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

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

Alternative 9: 86.0% accurate, 0.8× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+151}:\\ \;\;\;\;0.5 \cdot \left(\left(y + z\_m\right) \cdot \frac{y - z\_m}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(x + z\_m\right) \cdot \frac{x - z\_m}{y}\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m)
 :precision binary64
 (if (<= (* x x) 5e+151)
   (* 0.5 (* (+ y z_m) (/ (- y z_m) y)))
   (* 0.5 (* (+ x z_m) (/ (- x z_m) y)))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	double tmp;
	if ((x * x) <= 5e+151) {
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	} else {
		tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if ((x * x) <= 5d+151) then
        tmp = 0.5d0 * ((y + z_m) * ((y - z_m) / y))
    else
        tmp = 0.5d0 * ((x + z_m) * ((x - z_m) / y))
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	double tmp;
	if ((x * x) <= 5e+151) {
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	} else {
		tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m):
	tmp = 0
	if (x * x) <= 5e+151:
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y))
	else:
		tmp = 0.5 * ((x + z_m) * ((x - z_m) / y))
	return tmp
z_m = abs(z)
function code(x, y, z_m)
	tmp = 0.0
	if (Float64(x * x) <= 5e+151)
		tmp = Float64(0.5 * Float64(Float64(y + z_m) * Float64(Float64(y - z_m) / y)));
	else
		tmp = Float64(0.5 * Float64(Float64(x + z_m) * Float64(Float64(x - z_m) / y)));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m)
	tmp = 0.0;
	if ((x * x) <= 5e+151)
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	else
		tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e+151], N[(0.5 * N[(N[(y + z$95$m), $MachinePrecision] * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + z$95$m), $MachinePrecision] * N[(N[(x - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

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

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


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

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine79.4%

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

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

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

        \[\leadsto 0.5 \cdot \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} \]
      5. hypot-define80.2%

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

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

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

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

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

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

    if 5.0000000000000002e151 < (*.f64 x x)

    1. Initial program 59.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine59.0%

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

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

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

        \[\leadsto 0.5 \cdot \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} \]
      5. hypot-define73.6%

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

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

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

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

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

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

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

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

Alternative 10: 73.1% accurate, 0.9× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 7 \cdot 10^{+176}:\\ \;\;\;\;0.5 \cdot \left(\left(y + z\_m\right) \cdot \frac{y - z\_m}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{\frac{\frac{y}{x}}{x + z\_m}}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m)
 :precision binary64
 (if (<= x 7e+176)
   (* 0.5 (* (+ y z_m) (/ (- y z_m) y)))
   (/ 0.5 (/ (/ y x) (+ x z_m)))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	double tmp;
	if (x <= 7e+176) {
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	} else {
		tmp = 0.5 / ((y / x) / (x + z_m));
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if (x <= 7d+176) then
        tmp = 0.5d0 * ((y + z_m) * ((y - z_m) / y))
    else
        tmp = 0.5d0 / ((y / x) / (x + z_m))
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	double tmp;
	if (x <= 7e+176) {
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	} else {
		tmp = 0.5 / ((y / x) / (x + z_m));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m):
	tmp = 0
	if x <= 7e+176:
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y))
	else:
		tmp = 0.5 / ((y / x) / (x + z_m))
	return tmp
z_m = abs(z)
function code(x, y, z_m)
	tmp = 0.0
	if (x <= 7e+176)
		tmp = Float64(0.5 * Float64(Float64(y + z_m) * Float64(Float64(y - z_m) / y)));
	else
		tmp = Float64(0.5 / Float64(Float64(y / x) / Float64(x + z_m)));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m)
	tmp = 0.0;
	if (x <= 7e+176)
		tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
	else
		tmp = 0.5 / ((y / x) / (x + z_m));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := If[LessEqual[x, 7e+176], N[(0.5 * N[(N[(y + z$95$m), $MachinePrecision] * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(N[(y / x), $MachinePrecision] / N[(x + z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

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

\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{\frac{y}{x}}{x + z\_m}}\\


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

    1. Initial program 74.7%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out74.7%

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

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in74.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine74.3%

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

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

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

        \[\leadsto 0.5 \cdot \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} \]
      5. hypot-define78.0%

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

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

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

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

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

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

    if 7.00000000000000005e176 < x

    1. Initial program 45.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num61.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\color{blue}{\mathsf{hypot}\left(y, x\right)} - z}}{\mathsf{hypot}\left(x, y\right) + z}} \]
      10. +-commutative100.0%

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{\color{blue}{{y}^{2} + {x}^{2}}}}} \]
      15. unpow266.1%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \color{blue}{\mathsf{hypot}\left(y, x\right)}}} \]
    10. Simplified100.0%

      \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \mathsf{hypot}\left(y, x\right)}}} \]
    11. Taylor expanded in x around inf 92.3%

      \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{z + \mathsf{hypot}\left(y, x\right)}} \]
    12. Taylor expanded in y around 0 74.1%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{x}}{\color{blue}{z + x}}} \]
    14. Simplified92.2%

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

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

Alternative 11: 42.7% accurate, 1.2× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 6.6 \cdot 10^{+75}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m)
 :precision binary64
 (if (<= x 6.6e+75) (* 0.5 y) (* (* x x) (/ 0.5 y))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	double tmp;
	if (x <= 6.6e+75) {
		tmp = 0.5 * y;
	} else {
		tmp = (x * x) * (0.5 / y);
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if (x <= 6.6d+75) then
        tmp = 0.5d0 * y
    else
        tmp = (x * x) * (0.5d0 / y)
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	double tmp;
	if (x <= 6.6e+75) {
		tmp = 0.5 * y;
	} else {
		tmp = (x * x) * (0.5 / y);
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m):
	tmp = 0
	if x <= 6.6e+75:
		tmp = 0.5 * y
	else:
		tmp = (x * x) * (0.5 / y)
	return tmp
z_m = abs(z)
function code(x, y, z_m)
	tmp = 0.0
	if (x <= 6.6e+75)
		tmp = Float64(0.5 * y);
	else
		tmp = Float64(Float64(x * x) * Float64(0.5 / y));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m)
	tmp = 0.0;
	if (x <= 6.6e+75)
		tmp = 0.5 * y;
	else
		tmp = (x * x) * (0.5 / y);
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := If[LessEqual[x, 6.6e+75], N[(0.5 * y), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

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

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


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

    1. Initial program 74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 36.4%

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

    if 6.59999999999999996e75 < x

    1. Initial program 63.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 50.6%

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

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

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

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

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

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

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

Alternative 12: 36.1% accurate, 1.2× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 2.35 \cdot 10^{+207}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{z\_m}{y}\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m)
 :precision binary64
 (if (<= x 2.35e+207) (* 0.5 y) (* 0.5 (* x (/ z_m y)))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	double tmp;
	if (x <= 2.35e+207) {
		tmp = 0.5 * y;
	} else {
		tmp = 0.5 * (x * (z_m / y));
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if (x <= 2.35d+207) then
        tmp = 0.5d0 * y
    else
        tmp = 0.5d0 * (x * (z_m / y))
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	double tmp;
	if (x <= 2.35e+207) {
		tmp = 0.5 * y;
	} else {
		tmp = 0.5 * (x * (z_m / y));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m):
	tmp = 0
	if x <= 2.35e+207:
		tmp = 0.5 * y
	else:
		tmp = 0.5 * (x * (z_m / y))
	return tmp
z_m = abs(z)
function code(x, y, z_m)
	tmp = 0.0
	if (x <= 2.35e+207)
		tmp = Float64(0.5 * y);
	else
		tmp = Float64(0.5 * Float64(x * Float64(z_m / y)));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m)
	tmp = 0.0;
	if (x <= 2.35e+207)
		tmp = 0.5 * y;
	else
		tmp = 0.5 * (x * (z_m / y));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := If[LessEqual[x, 2.35e+207], N[(0.5 * y), $MachinePrecision], N[(0.5 * N[(x * N[(z$95$m / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

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

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


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

    1. Initial program 73.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 34.0%

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

    if 2.34999999999999988e207 < x

    1. Initial program 51.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num61.4%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{y}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}} \]
      2. un-div-inv61.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{\mathsf{hypot}\left(x, y\right) - z}}}{\mathsf{hypot}\left(x, y\right) + z}} \]
      3. hypot-undefine82.0%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\sqrt{{x}^{2} + \color{blue}{{y}^{2}}} - z}}{\mathsf{hypot}\left(x, y\right) + z}} \]
      6. +-commutative82.0%

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\sqrt{\color{blue}{{y}^{2} + {x}^{2}}} - z}}{\mathsf{hypot}\left(x, y\right) + z}} \]
      7. unpow282.0%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\color{blue}{\mathsf{hypot}\left(y, x\right)} - z}}{\mathsf{hypot}\left(x, y\right) + z}} \]
      10. +-commutative100.0%

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{\color{blue}{z + \mathsf{hypot}\left(x, y\right)}}} \]
      11. hypot-undefine72.0%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{{x}^{2} + \color{blue}{{y}^{2}}}}} \]
      14. +-commutative72.0%

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{\color{blue}{{y}^{2} + {x}^{2}}}}} \]
      15. unpow272.0%

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \color{blue}{\mathsf{hypot}\left(y, x\right)}}} \]
    10. Simplified100.0%

      \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \mathsf{hypot}\left(y, x\right)}}} \]
    11. Taylor expanded in x around inf 95.3%

      \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{z + \mathsf{hypot}\left(y, x\right)}} \]
    12. Taylor expanded in z around inf 25.5%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(x \cdot \frac{z}{y}\right)} \]
    14. Simplified25.5%

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

Alternative 13: 33.9% accurate, 5.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ 0.5 \cdot y \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m) :precision binary64 (* 0.5 y))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	return 0.5 * y;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    code = 0.5d0 * y
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	return 0.5 * y;
}
z_m = math.fabs(z)
def code(x, y, z_m):
	return 0.5 * y
z_m = abs(z)
function code(x, y, z_m)
	return Float64(0.5 * y)
end
z_m = abs(z);
function tmp = code(x, y, z_m)
	tmp = 0.5 * y;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := N[(0.5 * y), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
    8. distribute-lft-neg-in71.9%

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

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

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

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

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

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

    \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
  4. Add Preprocessing
  5. Taylor expanded in y around inf 31.9%

    \[\leadsto \color{blue}{0.5 \cdot y} \]
  6. Add Preprocessing

Alternative 14: 2.9% accurate, 5.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ 0.5 \cdot x \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m) :precision binary64 (* 0.5 x))
z_m = fabs(z);
double code(double x, double y, double z_m) {
	return 0.5 * x;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    code = 0.5d0 * x
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
	return 0.5 * x;
}
z_m = math.fabs(z)
def code(x, y, z_m):
	return 0.5 * x
z_m = abs(z)
function code(x, y, z_m)
	return Float64(0.5 * x)
end
z_m = abs(z);
function tmp = code(x, y, z_m)
	tmp = 0.5 * x;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := N[(0.5 * x), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|

\\
0.5 \cdot x
\end{array}
Derivation
  1. Initial program 71.9%

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
    8. distribute-lft-neg-in71.9%

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

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

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

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

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

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

    \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. clear-num74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\color{blue}{\mathsf{hypot}\left(y, x\right)} - z}}{\mathsf{hypot}\left(x, y\right) + z}} \]
    10. +-commutative99.8%

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{\color{blue}{z + \mathsf{hypot}\left(x, y\right)}}} \]
    11. hypot-undefine78.5%

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \color{blue}{\sqrt{x \cdot x + y \cdot y}}}} \]
    12. unpow278.5%

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{\color{blue}{{x}^{2}} + y \cdot y}}} \]
    13. unpow278.5%

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{{x}^{2} + \color{blue}{{y}^{2}}}}} \]
    14. +-commutative78.5%

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{\color{blue}{{y}^{2} + {x}^{2}}}}} \]
    15. unpow278.5%

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \sqrt{\color{blue}{y \cdot y} + {x}^{2}}}} \]
    16. unpow278.5%

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

      \[\leadsto \frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \color{blue}{\mathsf{hypot}\left(y, x\right)}}} \]
  10. Simplified99.8%

    \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z}}{z + \mathsf{hypot}\left(y, x\right)}}} \]
  11. Taylor expanded in x around inf 23.0%

    \[\leadsto \frac{0.5}{\frac{\color{blue}{\frac{y}{x}}}{z + \mathsf{hypot}\left(y, x\right)}} \]
  12. Taylor expanded in y around inf 3.0%

    \[\leadsto \color{blue}{0.5 \cdot x} \]
  13. Add Preprocessing

Developer Target 1: 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 2024133 
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
  :precision binary64

  :alt
  (! :herbie-platform default (- (* y 1/2) (* (* (/ 1/2 y) (+ z x)) (- z x))))

  (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))