Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2

Percentage Accurate: 88.7% → 99.5%
Time: 11.4s
Alternatives: 11
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 88.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.5% accurate, 0.0× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ \begin{array}{l} t_0 := z \cdot \sqrt{x\_m}\\ t_1 := y\_m \cdot \left(1 + z \cdot z\right)\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq 5 \cdot 10^{+307}:\\ \;\;\;\;\frac{\frac{1}{x\_m}}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{y\_m}}{t\_0}}{t\_0}\\ \end{array}\right) \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (* z (sqrt x_m))) (t_1 (* y_m (+ 1.0 (* z z)))))
   (*
    y_s
    (*
     x_s
     (if (<= t_1 5e+307) (/ (/ 1.0 x_m) t_1) (/ (/ (/ 1.0 y_m) t_0) t_0))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = z * sqrt(x_m);
	double t_1 = y_m * (1.0 + (z * z));
	double tmp;
	if (t_1 <= 5e+307) {
		tmp = (1.0 / x_m) / t_1;
	} else {
		tmp = ((1.0 / y_m) / t_0) / t_0;
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = z * sqrt(x_m)
    t_1 = y_m * (1.0d0 + (z * z))
    if (t_1 <= 5d+307) then
        tmp = (1.0d0 / x_m) / t_1
    else
        tmp = ((1.0d0 / y_m) / t_0) / t_0
    end if
    code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = z * Math.sqrt(x_m);
	double t_1 = y_m * (1.0 + (z * z));
	double tmp;
	if (t_1 <= 5e+307) {
		tmp = (1.0 / x_m) / t_1;
	} else {
		tmp = ((1.0 / y_m) / t_0) / t_0;
	}
	return y_s * (x_s * tmp);
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	t_0 = z * math.sqrt(x_m)
	t_1 = y_m * (1.0 + (z * z))
	tmp = 0
	if t_1 <= 5e+307:
		tmp = (1.0 / x_m) / t_1
	else:
		tmp = ((1.0 / y_m) / t_0) / t_0
	return y_s * (x_s * tmp)
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	t_0 = Float64(z * sqrt(x_m))
	t_1 = Float64(y_m * Float64(1.0 + Float64(z * z)))
	tmp = 0.0
	if (t_1 <= 5e+307)
		tmp = Float64(Float64(1.0 / x_m) / t_1);
	else
		tmp = Float64(Float64(Float64(1.0 / y_m) / t_0) / t_0);
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	t_0 = z * sqrt(x_m);
	t_1 = y_m * (1.0 + (z * z));
	tmp = 0.0;
	if (t_1 <= 5e+307)
		tmp = (1.0 / x_m) / t_1;
	else
		tmp = ((1.0 / y_m) / t_0) / t_0;
	end
	tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(z * N[Sqrt[x$95$m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[t$95$1, 5e+307], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[(1.0 / y$95$m), $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := z \cdot \sqrt{x\_m}\\
t_1 := y\_m \cdot \left(1 + z \cdot z\right)\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{y\_m}}{t\_0}}{t\_0}\\


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (+.f64 1 (*.f64 z z))) < 5e307

    1. Initial program 95.2%

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

    if 5e307 < (*.f64 y (+.f64 1 (*.f64 z z)))

    1. Initial program 72.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      4. add-sqr-sqrt71.2%

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

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      6. metadata-eval26.9%

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

        \[\leadsto \frac{1}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{x \cdot y}}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      8. fma-undefine26.9%

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

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

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(1, z\right)} \cdot \sqrt{x \cdot y}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      11. sqrt-div26.9%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}}} \]
      12. metadata-eval26.9%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{\color{blue}{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      13. sqrt-prod26.9%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{1}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{x \cdot y}}} \]
      14. fma-undefine26.9%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}}} \]
    7. Step-by-step derivation
      1. unpow-129.5%

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

        \[\leadsto {\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1} \cdot \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1}} \]
      3. pow-sqr29.4%

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

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

      \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-2}} \]
    9. Taylor expanded in z around inf 29.4%

      \[\leadsto {\color{blue}{\left(\sqrt{x \cdot y} \cdot z\right)}}^{-2} \]
    10. Step-by-step derivation
      1. metadata-eval29.4%

        \[\leadsto {\left(\sqrt{x \cdot y} \cdot z\right)}^{\color{blue}{\left(2 \cdot -1\right)}} \]
      2. pow-sqr29.5%

        \[\leadsto \color{blue}{{\left(\sqrt{x \cdot y} \cdot z\right)}^{-1} \cdot {\left(\sqrt{x \cdot y} \cdot z\right)}^{-1}} \]
      3. pow-prod-down29.4%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{x \cdot y} \cdot z\right) \cdot \left(\sqrt{x \cdot y} \cdot z\right)\right)}^{-1}} \]
      4. *-commutative29.4%

        \[\leadsto {\left(\color{blue}{\left(z \cdot \sqrt{x \cdot y}\right)} \cdot \left(\sqrt{x \cdot y} \cdot z\right)\right)}^{-1} \]
      5. *-commutative29.4%

        \[\leadsto {\left(\left(z \cdot \sqrt{x \cdot y}\right) \cdot \color{blue}{\left(z \cdot \sqrt{x \cdot y}\right)}\right)}^{-1} \]
      6. swap-sqr26.9%

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

        \[\leadsto {\left(\color{blue}{{z}^{2}} \cdot \left(\sqrt{x \cdot y} \cdot \sqrt{x \cdot y}\right)\right)}^{-1} \]
      8. add-sqr-sqrt78.5%

        \[\leadsto {\left({z}^{2} \cdot \color{blue}{\left(x \cdot y\right)}\right)}^{-1} \]
      9. associate-*l*79.0%

        \[\leadsto {\color{blue}{\left(\left({z}^{2} \cdot x\right) \cdot y\right)}}^{-1} \]
      10. *-commutative79.0%

        \[\leadsto {\left(\color{blue}{\left(x \cdot {z}^{2}\right)} \cdot y\right)}^{-1} \]
      11. inv-pow79.0%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x \cdot {z}^{2}}} \]
      13. add-sqr-sqrt27.3%

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y}}{\sqrt{x \cdot {z}^{2}}}}{\sqrt{x \cdot {z}^{2}}}} \]
    11. Applied egg-rr36.4%

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

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

Alternative 2: 99.3% accurate, 0.0× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \frac{\frac{\frac{{y\_m}^{-0.5}}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right) \cdot x\_m}}{\sqrt{y\_m}}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (/ (/ (/ (pow y_m -0.5) (hypot 1.0 z)) (* (hypot 1.0 z) x_m)) (sqrt y_m)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (((pow(y_m, -0.5) / hypot(1.0, z)) / (hypot(1.0, z) * x_m)) / sqrt(y_m)));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (((Math.pow(y_m, -0.5) / Math.hypot(1.0, z)) / (Math.hypot(1.0, z) * x_m)) / Math.sqrt(y_m)));
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	return y_s * (x_s * (((math.pow(y_m, -0.5) / math.hypot(1.0, z)) / (math.hypot(1.0, z) * x_m)) / math.sqrt(y_m)))
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	return Float64(y_s * Float64(x_s * Float64(Float64(Float64((y_m ^ -0.5) / hypot(1.0, z)) / Float64(hypot(1.0, z) * x_m)) / sqrt(y_m))))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
	tmp = y_s * (x_s * ((((y_m ^ -0.5) / hypot(1.0, z)) / (hypot(1.0, z) * x_m)) / sqrt(y_m)));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(N[(N[Power[y$95$m, -0.5], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \frac{\frac{\frac{{y\_m}^{-0.5}}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right) \cdot x\_m}}{\sqrt{y\_m}}\right)
\end{array}
Derivation
  1. Initial program 91.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
    6. metadata-eval43.9%

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

      \[\leadsto \frac{1}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{x \cdot y}}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
    8. fma-undefine43.9%

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

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

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}}} \]
    12. metadata-eval43.8%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}}} \]
  7. Step-by-step derivation
    1. unpow-145.1%

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

      \[\leadsto {\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1} \cdot \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1}} \]
    3. pow-sqr45.1%

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

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

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

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

    \[\leadsto \frac{\frac{\frac{{y}^{-0.5}}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right) \cdot x}}{\sqrt{y}} \]
  11. Add Preprocessing

Alternative 3: 98.7% accurate, 0.1× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \left(\frac{1}{y\_m} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right) \cdot x\_m}\right)\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (* x_s (* (/ 1.0 y_m) (/ (/ 1.0 (hypot 1.0 z)) (* (hypot 1.0 z) x_m))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * ((1.0 / y_m) * ((1.0 / hypot(1.0, z)) / (hypot(1.0, z) * x_m))));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * ((1.0 / y_m) * ((1.0 / Math.hypot(1.0, z)) / (Math.hypot(1.0, z) * x_m))));
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	return y_s * (x_s * ((1.0 / y_m) * ((1.0 / math.hypot(1.0, z)) / (math.hypot(1.0, z) * x_m))))
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	return Float64(y_s * Float64(x_s * Float64(Float64(1.0 / y_m) * Float64(Float64(1.0 / hypot(1.0, z)) / Float64(hypot(1.0, z) * x_m)))))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
	tmp = y_s * (x_s * ((1.0 / y_m) * ((1.0 / hypot(1.0, z)) / (hypot(1.0, z) * x_m))));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(1.0 / y$95$m), $MachinePrecision] * N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \left(\frac{1}{y\_m} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right) \cdot x\_m}\right)\right)
\end{array}
Derivation
  1. Initial program 91.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
    6. metadata-eval43.9%

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

      \[\leadsto \frac{1}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{x \cdot y}}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
    8. fma-undefine43.9%

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

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

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}}} \]
    12. metadata-eval43.8%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}}} \]
  7. Step-by-step derivation
    1. unpow-145.1%

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

      \[\leadsto {\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1} \cdot \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1}} \]
    3. pow-sqr45.1%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{{y}^{0.5}}}}{\sqrt{y}} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \mathsf{hypot}\left(1, z\right)} \]
    6. pow1/246.6%

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y} \cdot \sqrt{y}}} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \mathsf{hypot}\left(1, z\right)} \]
    8. add-sqr-sqrt96.3%

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

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

    \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right) \cdot x}} \]
  12. Final simplification96.3%

    \[\leadsto \frac{1}{y} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right) \cdot x} \]
  13. Add Preprocessing

Alternative 4: 98.4% accurate, 0.1× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+211}:\\ \;\;\;\;\frac{1}{y\_m} \cdot \frac{1}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y\_m}}{z} \cdot \frac{\frac{1}{x\_m}}{z}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= (* z z) 2e+211)
     (* (/ 1.0 y_m) (/ 1.0 (* x_m (fma z z 1.0))))
     (* (/ (/ 1.0 y_m) z) (/ (/ 1.0 x_m) z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if ((z * z) <= 2e+211) {
		tmp = (1.0 / y_m) * (1.0 / (x_m * fma(z, z, 1.0)));
	} else {
		tmp = ((1.0 / y_m) / z) * ((1.0 / x_m) / z);
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (Float64(z * z) <= 2e+211)
		tmp = Float64(Float64(1.0 / y_m) * Float64(1.0 / Float64(x_m * fma(z, z, 1.0))));
	else
		tmp = Float64(Float64(Float64(1.0 / y_m) / z) * Float64(Float64(1.0 / x_m) / z));
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e+211], N[(N[(1.0 / y$95$m), $MachinePrecision] * N[(1.0 / N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / y$95$m), $MachinePrecision] / z), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+211}:\\
\;\;\;\;\frac{1}{y\_m} \cdot \frac{1}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{z} \cdot \frac{\frac{1}{x\_m}}{z}\\


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

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e211 < (*.f64 z z)

    1. Initial program 77.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      4. add-sqr-sqrt72.0%

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

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      6. metadata-eval33.7%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}}} \]
    7. Step-by-step derivation
      1. unpow-137.9%

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

        \[\leadsto {\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1} \cdot \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1}} \]
      3. pow-sqr38.0%

        \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{\left(2 \cdot -1\right)}} \]
      4. metadata-eval38.0%

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

      \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-2}} \]
    9. Taylor expanded in z around inf 38.0%

      \[\leadsto {\color{blue}{\left(\sqrt{x \cdot y} \cdot z\right)}}^{-2} \]
    10. Step-by-step derivation
      1. metadata-eval38.0%

        \[\leadsto {\left(\sqrt{x \cdot y} \cdot z\right)}^{\color{blue}{\left(2 \cdot -1\right)}} \]
      2. pow-sqr37.9%

        \[\leadsto \color{blue}{{\left(\sqrt{x \cdot y} \cdot z\right)}^{-1} \cdot {\left(\sqrt{x \cdot y} \cdot z\right)}^{-1}} \]
      3. pow-prod-down37.8%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{x \cdot y} \cdot z\right) \cdot \left(\sqrt{x \cdot y} \cdot z\right)\right)}^{-1}} \]
      4. *-commutative37.8%

        \[\leadsto {\left(\color{blue}{\left(z \cdot \sqrt{x \cdot y}\right)} \cdot \left(\sqrt{x \cdot y} \cdot z\right)\right)}^{-1} \]
      5. *-commutative37.8%

        \[\leadsto {\left(\left(z \cdot \sqrt{x \cdot y}\right) \cdot \color{blue}{\left(z \cdot \sqrt{x \cdot y}\right)}\right)}^{-1} \]
      6. swap-sqr33.8%

        \[\leadsto {\color{blue}{\left(\left(z \cdot z\right) \cdot \left(\sqrt{x \cdot y} \cdot \sqrt{x \cdot y}\right)\right)}}^{-1} \]
      7. unpow233.8%

        \[\leadsto {\left(\color{blue}{{z}^{2}} \cdot \left(\sqrt{x \cdot y} \cdot \sqrt{x \cdot y}\right)\right)}^{-1} \]
      8. add-sqr-sqrt76.1%

        \[\leadsto {\left({z}^{2} \cdot \color{blue}{\left(x \cdot y\right)}\right)}^{-1} \]
      9. associate-*l*72.9%

        \[\leadsto {\color{blue}{\left(\left({z}^{2} \cdot x\right) \cdot y\right)}}^{-1} \]
      10. *-commutative72.9%

        \[\leadsto {\left(\color{blue}{\left(x \cdot {z}^{2}\right)} \cdot y\right)}^{-1} \]
      11. inv-pow72.9%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{1}{y \cdot x}}}{{z}^{2}} \]
      15. associate-/l/76.1%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{y}}}{{z}^{2}} \]
      16. unpow276.1%

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{1}{x}}{y}}{z}}{z}} \]
      18. associate-/l/85.5%

        \[\leadsto \frac{\frac{\color{blue}{\frac{1}{y \cdot x}}}{z}}{z} \]
    11. Applied egg-rr85.5%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y \cdot x}}{z}}{z}} \]
    12. Step-by-step derivation
      1. associate-/l/76.1%

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

        \[\leadsto \frac{\frac{\color{blue}{1 \cdot 1}}{y \cdot x}}{z \cdot z} \]
      3. frac-times76.0%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{z} \cdot \frac{\frac{1}{x}}{z}} \]
    13. Applied egg-rr99.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+211}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{1}{x \cdot \mathsf{fma}\left(z, z, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y}}{z} \cdot \frac{\frac{1}{x}}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 98.2% accurate, 0.1× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+229}:\\ \;\;\;\;\frac{1}{y\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y\_m}}{z} \cdot \frac{\frac{1}{x\_m}}{z}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= (* z z) 2e+229)
     (/ 1.0 (* y_m (* x_m (fma z z 1.0))))
     (* (/ (/ 1.0 y_m) z) (/ (/ 1.0 x_m) z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if ((z * z) <= 2e+229) {
		tmp = 1.0 / (y_m * (x_m * fma(z, z, 1.0)));
	} else {
		tmp = ((1.0 / y_m) / z) * ((1.0 / x_m) / z);
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (Float64(z * z) <= 2e+229)
		tmp = Float64(1.0 / Float64(y_m * Float64(x_m * fma(z, z, 1.0))));
	else
		tmp = Float64(Float64(Float64(1.0 / y_m) / z) * Float64(Float64(1.0 / x_m) / z));
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e+229], N[(1.0 / N[(y$95$m * N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / y$95$m), $MachinePrecision] / z), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+229}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{z} \cdot \frac{\frac{1}{x\_m}}{z}\\


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

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y \cdot \left(x \cdot \mathsf{fma}\left(z, z, 1\right)\right)}} \]
    4. Add Preprocessing

    if 2e229 < (*.f64 z z)

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      4. add-sqr-sqrt71.2%

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

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      6. metadata-eval31.9%

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

        \[\leadsto \frac{1}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{x \cdot y}}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      8. fma-undefine31.9%

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

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

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(1, z\right)} \cdot \sqrt{x \cdot y}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      11. sqrt-div31.9%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}}} \]
      12. metadata-eval31.9%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{\color{blue}{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      13. sqrt-prod31.9%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{1}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{x \cdot y}}} \]
      14. fma-undefine31.9%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}}} \]
    7. Step-by-step derivation
      1. unpow-136.2%

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

        \[\leadsto {\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1} \cdot \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1}} \]
      3. pow-sqr36.3%

        \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{\left(2 \cdot -1\right)}} \]
      4. metadata-eval36.3%

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

      \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-2}} \]
    9. Taylor expanded in z around inf 36.3%

      \[\leadsto {\color{blue}{\left(\sqrt{x \cdot y} \cdot z\right)}}^{-2} \]
    10. Step-by-step derivation
      1. metadata-eval36.3%

        \[\leadsto {\left(\sqrt{x \cdot y} \cdot z\right)}^{\color{blue}{\left(2 \cdot -1\right)}} \]
      2. pow-sqr36.2%

        \[\leadsto \color{blue}{{\left(\sqrt{x \cdot y} \cdot z\right)}^{-1} \cdot {\left(\sqrt{x \cdot y} \cdot z\right)}^{-1}} \]
      3. pow-prod-down36.1%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{x \cdot y} \cdot z\right) \cdot \left(\sqrt{x \cdot y} \cdot z\right)\right)}^{-1}} \]
      4. *-commutative36.1%

        \[\leadsto {\left(\color{blue}{\left(z \cdot \sqrt{x \cdot y}\right)} \cdot \left(\sqrt{x \cdot y} \cdot z\right)\right)}^{-1} \]
      5. *-commutative36.1%

        \[\leadsto {\left(\left(z \cdot \sqrt{x \cdot y}\right) \cdot \color{blue}{\left(z \cdot \sqrt{x \cdot y}\right)}\right)}^{-1} \]
      6. swap-sqr31.9%

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

        \[\leadsto {\left(\color{blue}{{z}^{2}} \cdot \left(\sqrt{x \cdot y} \cdot \sqrt{x \cdot y}\right)\right)}^{-1} \]
      8. add-sqr-sqrt75.4%

        \[\leadsto {\left({z}^{2} \cdot \color{blue}{\left(x \cdot y\right)}\right)}^{-1} \]
      9. associate-*l*73.5%

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

        \[\leadsto {\left(\color{blue}{\left(x \cdot {z}^{2}\right)} \cdot y\right)}^{-1} \]
      11. inv-pow73.5%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{1}{y \cdot x}}}{{z}^{2}} \]
      15. associate-/l/75.4%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{y}}}{{z}^{2}} \]
      16. unpow275.4%

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{1}{x}}{y}}{z}}{z}} \]
      18. associate-/l/85.1%

        \[\leadsto \frac{\frac{\color{blue}{\frac{1}{y \cdot x}}}{z}}{z} \]
    11. Applied egg-rr85.1%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y \cdot x}}{z}}{z}} \]
    12. Step-by-step derivation
      1. associate-/l/75.4%

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

        \[\leadsto \frac{\frac{\color{blue}{1 \cdot 1}}{y \cdot x}}{z \cdot z} \]
      3. frac-times75.4%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{z} \cdot \frac{\frac{1}{x}}{z}} \]
    13. Applied egg-rr99.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+229}:\\ \;\;\;\;\frac{1}{y \cdot \left(x \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y}}{z} \cdot \frac{\frac{1}{x}}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 99.4% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ \begin{array}{l} t_0 := y\_m \cdot \left(1 + z \cdot z\right)\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 5 \cdot 10^{+307}:\\ \;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y\_m \cdot \left(z \cdot x\_m\right)}}{z}\\ \end{array}\right) \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (* y_m (+ 1.0 (* z z)))))
   (*
    y_s
    (*
     x_s
     (if (<= t_0 5e+307)
       (/ (/ 1.0 x_m) t_0)
       (/ (/ 1.0 (* y_m (* z x_m))) z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = y_m * (1.0 + (z * z));
	double tmp;
	if (t_0 <= 5e+307) {
		tmp = (1.0 / x_m) / t_0;
	} else {
		tmp = (1.0 / (y_m * (z * x_m))) / z;
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y_m * (1.0d0 + (z * z))
    if (t_0 <= 5d+307) then
        tmp = (1.0d0 / x_m) / t_0
    else
        tmp = (1.0d0 / (y_m * (z * x_m))) / z
    end if
    code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = y_m * (1.0 + (z * z));
	double tmp;
	if (t_0 <= 5e+307) {
		tmp = (1.0 / x_m) / t_0;
	} else {
		tmp = (1.0 / (y_m * (z * x_m))) / z;
	}
	return y_s * (x_s * tmp);
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	t_0 = y_m * (1.0 + (z * z))
	tmp = 0
	if t_0 <= 5e+307:
		tmp = (1.0 / x_m) / t_0
	else:
		tmp = (1.0 / (y_m * (z * x_m))) / z
	return y_s * (x_s * tmp)
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	t_0 = Float64(y_m * Float64(1.0 + Float64(z * z)))
	tmp = 0.0
	if (t_0 <= 5e+307)
		tmp = Float64(Float64(1.0 / x_m) / t_0);
	else
		tmp = Float64(Float64(1.0 / Float64(y_m * Float64(z * x_m))) / z);
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	t_0 = y_m * (1.0 + (z * z));
	tmp = 0.0;
	if (t_0 <= 5e+307)
		tmp = (1.0 / x_m) / t_0;
	else
		tmp = (1.0 / (y_m * (z * x_m))) / z;
	end
	tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[t$95$0, 5e+307], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / N[(y$95$m * N[(z * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := y\_m \cdot \left(1 + z \cdot z\right)\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\

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


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (+.f64 1 (*.f64 z z))) < 5e307

    1. Initial program 95.2%

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

    if 5e307 < (*.f64 y (+.f64 1 (*.f64 z z)))

    1. Initial program 72.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      4. add-sqr-sqrt71.2%

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

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      6. metadata-eval26.9%

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

        \[\leadsto \frac{1}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{x \cdot y}}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      8. fma-undefine26.9%

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

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

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(1, z\right)} \cdot \sqrt{x \cdot y}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      11. sqrt-div26.9%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}}} \]
      12. metadata-eval26.9%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{\color{blue}{1}}{\sqrt{\mathsf{fma}\left(z, z, 1\right) \cdot \left(x \cdot y\right)}} \]
      13. sqrt-prod26.9%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{1}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{x \cdot y}}} \]
      14. fma-undefine26.9%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}}} \]
    7. Step-by-step derivation
      1. unpow-129.5%

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

        \[\leadsto {\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1} \cdot \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1}} \]
      3. pow-sqr29.4%

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

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

      \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-2}} \]
    9. Taylor expanded in z around inf 29.4%

      \[\leadsto {\color{blue}{\left(\sqrt{x \cdot y} \cdot z\right)}}^{-2} \]
    10. Step-by-step derivation
      1. metadata-eval29.4%

        \[\leadsto {\left(\sqrt{x \cdot y} \cdot z\right)}^{\color{blue}{\left(2 \cdot -1\right)}} \]
      2. pow-sqr29.5%

        \[\leadsto \color{blue}{{\left(\sqrt{x \cdot y} \cdot z\right)}^{-1} \cdot {\left(\sqrt{x \cdot y} \cdot z\right)}^{-1}} \]
      3. pow-prod-down29.4%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{x \cdot y} \cdot z\right) \cdot \left(\sqrt{x \cdot y} \cdot z\right)\right)}^{-1}} \]
      4. *-commutative29.4%

        \[\leadsto {\left(\color{blue}{\left(z \cdot \sqrt{x \cdot y}\right)} \cdot \left(\sqrt{x \cdot y} \cdot z\right)\right)}^{-1} \]
      5. *-commutative29.4%

        \[\leadsto {\left(\left(z \cdot \sqrt{x \cdot y}\right) \cdot \color{blue}{\left(z \cdot \sqrt{x \cdot y}\right)}\right)}^{-1} \]
      6. swap-sqr26.9%

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

        \[\leadsto {\left(\color{blue}{{z}^{2}} \cdot \left(\sqrt{x \cdot y} \cdot \sqrt{x \cdot y}\right)\right)}^{-1} \]
      8. add-sqr-sqrt78.5%

        \[\leadsto {\left({z}^{2} \cdot \color{blue}{\left(x \cdot y\right)}\right)}^{-1} \]
      9. associate-*l*79.0%

        \[\leadsto {\color{blue}{\left(\left({z}^{2} \cdot x\right) \cdot y\right)}}^{-1} \]
      10. *-commutative79.0%

        \[\leadsto {\left(\color{blue}{\left(x \cdot {z}^{2}\right)} \cdot y\right)}^{-1} \]
      11. inv-pow79.0%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{1}{y \cdot x}}}{{z}^{2}} \]
      15. associate-/l/78.5%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{y}}}{{z}^{2}} \]
      16. unpow278.5%

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{1}{x}}{y}}{z}}{z}} \]
      18. associate-/l/88.0%

        \[\leadsto \frac{\frac{\color{blue}{\frac{1}{y \cdot x}}}{z}}{z} \]
    11. Applied egg-rr88.0%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y \cdot x}}{z}}{z}} \]
    12. Taylor expanded in y around 0 95.2%

      \[\leadsto \frac{\color{blue}{\frac{1}{x \cdot \left(y \cdot z\right)}}}{z} \]
    13. Step-by-step derivation
      1. *-commutative95.2%

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x \cdot z}}{y}}}{z} \]
      4. associate-/l/97.6%

        \[\leadsto \frac{\color{blue}{\frac{1}{y \cdot \left(x \cdot z\right)}}}{z} \]
    14. Simplified97.6%

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

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

Alternative 7: 77.8% accurate, 0.7× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\ \;\;\;\;\frac{\frac{1}{x\_m}}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y\_m}}{z} \cdot \frac{\frac{1}{x\_m}}{z}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= z 7e-5)
     (/ (/ 1.0 x_m) y_m)
     (* (/ (/ 1.0 y_m) z) (/ (/ 1.0 x_m) z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= 7e-5) {
		tmp = (1.0 / x_m) / y_m;
	} else {
		tmp = ((1.0 / y_m) / z) * ((1.0 / x_m) / z);
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= 7d-5) then
        tmp = (1.0d0 / x_m) / y_m
    else
        tmp = ((1.0d0 / y_m) / z) * ((1.0d0 / x_m) / z)
    end if
    code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= 7e-5) {
		tmp = (1.0 / x_m) / y_m;
	} else {
		tmp = ((1.0 / y_m) / z) * ((1.0 / x_m) / z);
	}
	return y_s * (x_s * tmp);
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	tmp = 0
	if z <= 7e-5:
		tmp = (1.0 / x_m) / y_m
	else:
		tmp = ((1.0 / y_m) / z) * ((1.0 / x_m) / z)
	return y_s * (x_s * tmp)
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (z <= 7e-5)
		tmp = Float64(Float64(1.0 / x_m) / y_m);
	else
		tmp = Float64(Float64(Float64(1.0 / y_m) / z) * Float64(Float64(1.0 / x_m) / z));
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0;
	if (z <= 7e-5)
		tmp = (1.0 / x_m) / y_m;
	else
		tmp = ((1.0 / y_m) / z) * ((1.0 / x_m) / z);
	end
	tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 7e-5], N[(N[(1.0 / x$95$m), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(1.0 / y$95$m), $MachinePrecision] / z), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{z} \cdot \frac{\frac{1}{x\_m}}{z}\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 6.9999999999999994e-5

    1. Initial program 94.3%

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

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y}} \]

    if 6.9999999999999994e-5 < z

    1. Initial program 82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}}} \]
    7. Step-by-step derivation
      1. unpow-139.0%

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

        \[\leadsto {\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1} \cdot \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1}} \]
      3. pow-sqr39.1%

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

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

      \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-2}} \]
    9. Taylor expanded in z around inf 37.5%

      \[\leadsto {\color{blue}{\left(\sqrt{x \cdot y} \cdot z\right)}}^{-2} \]
    10. Step-by-step derivation
      1. metadata-eval37.5%

        \[\leadsto {\left(\sqrt{x \cdot y} \cdot z\right)}^{\color{blue}{\left(2 \cdot -1\right)}} \]
      2. pow-sqr37.5%

        \[\leadsto \color{blue}{{\left(\sqrt{x \cdot y} \cdot z\right)}^{-1} \cdot {\left(\sqrt{x \cdot y} \cdot z\right)}^{-1}} \]
      3. pow-prod-down37.3%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{x \cdot y} \cdot z\right) \cdot \left(\sqrt{x \cdot y} \cdot z\right)\right)}^{-1}} \]
      4. *-commutative37.3%

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

        \[\leadsto {\left(\left(z \cdot \sqrt{x \cdot y}\right) \cdot \color{blue}{\left(z \cdot \sqrt{x \cdot y}\right)}\right)}^{-1} \]
      6. swap-sqr35.5%

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

        \[\leadsto {\left(\color{blue}{{z}^{2}} \cdot \left(\sqrt{x \cdot y} \cdot \sqrt{x \cdot y}\right)\right)}^{-1} \]
      8. add-sqr-sqrt78.1%

        \[\leadsto {\left({z}^{2} \cdot \color{blue}{\left(x \cdot y\right)}\right)}^{-1} \]
      9. associate-*l*78.7%

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

        \[\leadsto {\left(\color{blue}{\left(x \cdot {z}^{2}\right)} \cdot y\right)}^{-1} \]
      11. inv-pow78.7%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{1}{y \cdot x}}}{{z}^{2}} \]
      15. associate-/l/78.4%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{y}}}{{z}^{2}} \]
      16. unpow278.4%

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{1}{x}}{y}}{z}}{z}} \]
      18. associate-/l/83.3%

        \[\leadsto \frac{\frac{\color{blue}{\frac{1}{y \cdot x}}}{z}}{z} \]
    11. Applied egg-rr83.3%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y \cdot x}}{z}}{z}} \]
    12. Step-by-step derivation
      1. associate-/l/78.4%

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

        \[\leadsto \frac{\frac{\color{blue}{1 \cdot 1}}{y \cdot x}}{z \cdot z} \]
      3. frac-times78.4%

        \[\leadsto \frac{\color{blue}{\frac{1}{y} \cdot \frac{1}{x}}}{z \cdot z} \]
      4. times-frac95.7%

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{z} \cdot \frac{\frac{1}{x}}{z}} \]
    13. Applied egg-rr95.7%

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

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

Alternative 8: 74.4% accurate, 0.8× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\ \;\;\;\;\frac{\frac{1}{x\_m}}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x\_m}}{z \cdot \left(y\_m \cdot z\right)}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= z 7e-5) (/ (/ 1.0 x_m) y_m) (/ (/ 1.0 x_m) (* z (* y_m z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= 7e-5) {
		tmp = (1.0 / x_m) / y_m;
	} else {
		tmp = (1.0 / x_m) / (z * (y_m * z));
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= 7d-5) then
        tmp = (1.0d0 / x_m) / y_m
    else
        tmp = (1.0d0 / x_m) / (z * (y_m * z))
    end if
    code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= 7e-5) {
		tmp = (1.0 / x_m) / y_m;
	} else {
		tmp = (1.0 / x_m) / (z * (y_m * z));
	}
	return y_s * (x_s * tmp);
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	tmp = 0
	if z <= 7e-5:
		tmp = (1.0 / x_m) / y_m
	else:
		tmp = (1.0 / x_m) / (z * (y_m * z))
	return y_s * (x_s * tmp)
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (z <= 7e-5)
		tmp = Float64(Float64(1.0 / x_m) / y_m);
	else
		tmp = Float64(Float64(1.0 / x_m) / Float64(z * Float64(y_m * z)));
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0;
	if (z <= 7e-5)
		tmp = (1.0 / x_m) / y_m;
	else
		tmp = (1.0 / x_m) / (z * (y_m * z));
	end
	tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 7e-5], N[(N[(1.0 / x$95$m), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(z * N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 6.9999999999999994e-5

    1. Initial program 94.3%

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

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y}} \]

    if 6.9999999999999994e-5 < z

    1. Initial program 82.1%

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

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

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

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

        \[\leadsto \frac{\frac{1}{x}}{{\left(\sqrt{y \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}}\right)}^{2}} \]
      5. *-commutative37.5%

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}^{2}}} \]
    5. Taylor expanded in z around inf 38.5%

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

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

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

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

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

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

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

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

Alternative 9: 77.1% accurate, 0.8× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\ \;\;\;\;\frac{\frac{1}{x\_m}}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x\_m \cdot \left(y\_m \cdot z\right)}}{z}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= z 7e-5) (/ (/ 1.0 x_m) y_m) (/ (/ 1.0 (* x_m (* y_m z))) z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= 7e-5) {
		tmp = (1.0 / x_m) / y_m;
	} else {
		tmp = (1.0 / (x_m * (y_m * z))) / z;
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= 7d-5) then
        tmp = (1.0d0 / x_m) / y_m
    else
        tmp = (1.0d0 / (x_m * (y_m * z))) / z
    end if
    code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= 7e-5) {
		tmp = (1.0 / x_m) / y_m;
	} else {
		tmp = (1.0 / (x_m * (y_m * z))) / z;
	}
	return y_s * (x_s * tmp);
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	tmp = 0
	if z <= 7e-5:
		tmp = (1.0 / x_m) / y_m
	else:
		tmp = (1.0 / (x_m * (y_m * z))) / z
	return y_s * (x_s * tmp)
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (z <= 7e-5)
		tmp = Float64(Float64(1.0 / x_m) / y_m);
	else
		tmp = Float64(Float64(1.0 / Float64(x_m * Float64(y_m * z))) / z);
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0;
	if (z <= 7e-5)
		tmp = (1.0 / x_m) / y_m;
	else
		tmp = (1.0 / (x_m * (y_m * z))) / z;
	end
	tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 7e-5], N[(N[(1.0 / x$95$m), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(1.0 / N[(x$95$m * N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 6.9999999999999994e-5

    1. Initial program 94.3%

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

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y}} \]

    if 6.9999999999999994e-5 < z

    1. Initial program 82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}}} \]
    7. Step-by-step derivation
      1. unpow-139.0%

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

        \[\leadsto {\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1} \cdot \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1}} \]
      3. pow-sqr39.1%

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

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

      \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-2}} \]
    9. Taylor expanded in z around inf 37.5%

      \[\leadsto {\color{blue}{\left(\sqrt{x \cdot y} \cdot z\right)}}^{-2} \]
    10. Step-by-step derivation
      1. metadata-eval37.5%

        \[\leadsto {\left(\sqrt{x \cdot y} \cdot z\right)}^{\color{blue}{\left(2 \cdot -1\right)}} \]
      2. pow-sqr37.5%

        \[\leadsto \color{blue}{{\left(\sqrt{x \cdot y} \cdot z\right)}^{-1} \cdot {\left(\sqrt{x \cdot y} \cdot z\right)}^{-1}} \]
      3. pow-prod-down37.3%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{x \cdot y} \cdot z\right) \cdot \left(\sqrt{x \cdot y} \cdot z\right)\right)}^{-1}} \]
      4. *-commutative37.3%

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

        \[\leadsto {\left(\left(z \cdot \sqrt{x \cdot y}\right) \cdot \color{blue}{\left(z \cdot \sqrt{x \cdot y}\right)}\right)}^{-1} \]
      6. swap-sqr35.5%

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

        \[\leadsto {\left(\color{blue}{{z}^{2}} \cdot \left(\sqrt{x \cdot y} \cdot \sqrt{x \cdot y}\right)\right)}^{-1} \]
      8. add-sqr-sqrt78.1%

        \[\leadsto {\left({z}^{2} \cdot \color{blue}{\left(x \cdot y\right)}\right)}^{-1} \]
      9. associate-*l*78.7%

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

        \[\leadsto {\left(\color{blue}{\left(x \cdot {z}^{2}\right)} \cdot y\right)}^{-1} \]
      11. inv-pow78.7%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{1}{y \cdot x}}}{{z}^{2}} \]
      15. associate-/l/78.4%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{y}}}{{z}^{2}} \]
      16. unpow278.4%

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{1}{x}}{y}}{z}}{z}} \]
      18. associate-/l/83.3%

        \[\leadsto \frac{\frac{\color{blue}{\frac{1}{y \cdot x}}}{z}}{z} \]
    11. Applied egg-rr83.3%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y \cdot x}}{z}}{z}} \]
    12. Taylor expanded in y around 0 94.8%

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

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

Alternative 10: 78.3% accurate, 0.8× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\ \;\;\;\;\frac{\frac{1}{x\_m}}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y\_m \cdot \left(z \cdot x\_m\right)}}{z}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= z 7e-5) (/ (/ 1.0 x_m) y_m) (/ (/ 1.0 (* y_m (* z x_m))) z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= 7e-5) {
		tmp = (1.0 / x_m) / y_m;
	} else {
		tmp = (1.0 / (y_m * (z * x_m))) / z;
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= 7d-5) then
        tmp = (1.0d0 / x_m) / y_m
    else
        tmp = (1.0d0 / (y_m * (z * x_m))) / z
    end if
    code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= 7e-5) {
		tmp = (1.0 / x_m) / y_m;
	} else {
		tmp = (1.0 / (y_m * (z * x_m))) / z;
	}
	return y_s * (x_s * tmp);
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	tmp = 0
	if z <= 7e-5:
		tmp = (1.0 / x_m) / y_m
	else:
		tmp = (1.0 / (y_m * (z * x_m))) / z
	return y_s * (x_s * tmp)
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (z <= 7e-5)
		tmp = Float64(Float64(1.0 / x_m) / y_m);
	else
		tmp = Float64(Float64(1.0 / Float64(y_m * Float64(z * x_m))) / z);
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0;
	if (z <= 7e-5)
		tmp = (1.0 / x_m) / y_m;
	else
		tmp = (1.0 / (y_m * (z * x_m))) / z;
	end
	tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 7e-5], N[(N[(1.0 / x$95$m), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(1.0 / N[(y$95$m * N[(z * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 6.9999999999999994e-5

    1. Initial program 94.3%

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

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y}} \]

    if 6.9999999999999994e-5 < z

    1. Initial program 82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}}} \]
    7. Step-by-step derivation
      1. unpow-139.0%

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

        \[\leadsto {\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1} \cdot \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-1}} \]
      3. pow-sqr39.1%

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

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

      \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x \cdot y}\right)}^{-2}} \]
    9. Taylor expanded in z around inf 37.5%

      \[\leadsto {\color{blue}{\left(\sqrt{x \cdot y} \cdot z\right)}}^{-2} \]
    10. Step-by-step derivation
      1. metadata-eval37.5%

        \[\leadsto {\left(\sqrt{x \cdot y} \cdot z\right)}^{\color{blue}{\left(2 \cdot -1\right)}} \]
      2. pow-sqr37.5%

        \[\leadsto \color{blue}{{\left(\sqrt{x \cdot y} \cdot z\right)}^{-1} \cdot {\left(\sqrt{x \cdot y} \cdot z\right)}^{-1}} \]
      3. pow-prod-down37.3%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{x \cdot y} \cdot z\right) \cdot \left(\sqrt{x \cdot y} \cdot z\right)\right)}^{-1}} \]
      4. *-commutative37.3%

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

        \[\leadsto {\left(\left(z \cdot \sqrt{x \cdot y}\right) \cdot \color{blue}{\left(z \cdot \sqrt{x \cdot y}\right)}\right)}^{-1} \]
      6. swap-sqr35.5%

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

        \[\leadsto {\left(\color{blue}{{z}^{2}} \cdot \left(\sqrt{x \cdot y} \cdot \sqrt{x \cdot y}\right)\right)}^{-1} \]
      8. add-sqr-sqrt78.1%

        \[\leadsto {\left({z}^{2} \cdot \color{blue}{\left(x \cdot y\right)}\right)}^{-1} \]
      9. associate-*l*78.7%

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

        \[\leadsto {\left(\color{blue}{\left(x \cdot {z}^{2}\right)} \cdot y\right)}^{-1} \]
      11. inv-pow78.7%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{1}{y \cdot x}}}{{z}^{2}} \]
      15. associate-/l/78.4%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{y}}}{{z}^{2}} \]
      16. unpow278.4%

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{1}{x}}{y}}{z}}{z}} \]
      18. associate-/l/83.3%

        \[\leadsto \frac{\frac{\color{blue}{\frac{1}{y \cdot x}}}{z}}{z} \]
    11. Applied egg-rr83.3%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y \cdot x}}{z}}{z}} \]
    12. Taylor expanded in y around 0 94.8%

      \[\leadsto \frac{\color{blue}{\frac{1}{x \cdot \left(y \cdot z\right)}}}{z} \]
    13. Step-by-step derivation
      1. *-commutative94.8%

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x \cdot z}}{y}}}{z} \]
      4. associate-/l/94.9%

        \[\leadsto \frac{\color{blue}{\frac{1}{y \cdot \left(x \cdot z\right)}}}{z} \]
    14. Simplified94.9%

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

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

Alternative 11: 58.7% accurate, 2.2× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \frac{1}{y\_m \cdot x\_m}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (/ 1.0 (* y_m x_m)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (1.0 / (y_m * x_m)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    code = y_s * (x_s * (1.0d0 / (y_m * x_m)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (1.0 / (y_m * x_m)));
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	return y_s * (x_s * (1.0 / (y_m * x_m)))
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	return Float64(y_s * Float64(x_s * Float64(1.0 / Float64(y_m * x_m))))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
	tmp = y_s * (x_s * (1.0 / (y_m * x_m)));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(1.0 / N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \frac{1}{y\_m \cdot x\_m}\right)
\end{array}
Derivation
  1. Initial program 91.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{y \cdot \color{blue}{x}} \]
  6. Final simplification59.7%

    \[\leadsto \frac{1}{y \cdot x} \]
  7. Add Preprocessing

Developer target: 92.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + z \cdot z\\ t_1 := y \cdot t\_0\\ t_2 := \frac{\frac{1}{y}}{t\_0 \cdot x}\\ \mathbf{if}\;t\_1 < -\infty:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 < 8.680743250567252 \cdot 10^{+305}:\\ \;\;\;\;\frac{\frac{1}{x}}{t\_0 \cdot y}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* z z))) (t_1 (* y t_0)) (t_2 (/ (/ 1.0 y) (* t_0 x))))
   (if (< t_1 (- INFINITY))
     t_2
     (if (< t_1 8.680743250567252e+305) (/ (/ 1.0 x) (* t_0 y)) t_2))))
double code(double x, double y, double z) {
	double t_0 = 1.0 + (z * z);
	double t_1 = y * t_0;
	double t_2 = (1.0 / y) / (t_0 * x);
	double tmp;
	if (t_1 < -((double) INFINITY)) {
		tmp = t_2;
	} else if (t_1 < 8.680743250567252e+305) {
		tmp = (1.0 / x) / (t_0 * y);
	} else {
		tmp = t_2;
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double t_0 = 1.0 + (z * z);
	double t_1 = y * t_0;
	double t_2 = (1.0 / y) / (t_0 * x);
	double tmp;
	if (t_1 < -Double.POSITIVE_INFINITY) {
		tmp = t_2;
	} else if (t_1 < 8.680743250567252e+305) {
		tmp = (1.0 / x) / (t_0 * y);
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 + (z * z)
	t_1 = y * t_0
	t_2 = (1.0 / y) / (t_0 * x)
	tmp = 0
	if t_1 < -math.inf:
		tmp = t_2
	elif t_1 < 8.680743250567252e+305:
		tmp = (1.0 / x) / (t_0 * y)
	else:
		tmp = t_2
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 + Float64(z * z))
	t_1 = Float64(y * t_0)
	t_2 = Float64(Float64(1.0 / y) / Float64(t_0 * x))
	tmp = 0.0
	if (t_1 < Float64(-Inf))
		tmp = t_2;
	elseif (t_1 < 8.680743250567252e+305)
		tmp = Float64(Float64(1.0 / x) / Float64(t_0 * y));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 + (z * z);
	t_1 = y * t_0;
	t_2 = (1.0 / y) / (t_0 * x);
	tmp = 0.0;
	if (t_1 < -Inf)
		tmp = t_2;
	elseif (t_1 < 8.680743250567252e+305)
		tmp = (1.0 / x) / (t_0 * y);
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 / y), $MachinePrecision] / N[(t$95$0 * x), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, (-Infinity)], t$95$2, If[Less[t$95$1, 8.680743250567252e+305], N[(N[(1.0 / x), $MachinePrecision] / N[(t$95$0 * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + z \cdot z\\
t_1 := y \cdot t\_0\\
t_2 := \frac{\frac{1}{y}}{t\_0 \cdot x}\\
\mathbf{if}\;t\_1 < -\infty:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 < 8.680743250567252 \cdot 10^{+305}:\\
\;\;\;\;\frac{\frac{1}{x}}{t\_0 \cdot y}\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024053 
(FPCore (x y z)
  :name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
  :precision binary64

  :alt
  (if (< (* y (+ 1.0 (* z z))) (- INFINITY)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x)) (if (< (* y (+ 1.0 (* z z))) 8.680743250567252e+305) (/ (/ 1.0 x) (* (+ 1.0 (* z z)) y)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x))))

  (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))