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

Percentage Accurate: 89.5% → 99.0%
Time: 13.1s
Alternatives: 9
Speedup: 1.0×

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 9 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: 89.5% 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.0% 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}\;y\_m \leq 5.8 \cdot 10^{+141}:\\ \;\;\;\;\frac{1}{\left(\mathsf{hypot}\left(1, z\right) \cdot y\_m\right) \cdot \left(x\_m \cdot \mathsf{hypot}\left(1, z\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y\_m}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 (<= y_m 5.8e+141)
     (/ 1.0 (* (* (hypot 1.0 z) y_m) (* x_m (hypot 1.0 z))))
     (/ (/ 1.0 y_m) (* x_m (fma z z 1.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 tmp;
	if (y_m <= 5.8e+141) {
		tmp = 1.0 / ((hypot(1.0, z) * y_m) * (x_m * hypot(1.0, z)));
	} else {
		tmp = (1.0 / y_m) / (x_m * fma(z, z, 1.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)
	tmp = 0.0
	if (y_m <= 5.8e+141)
		tmp = Float64(1.0 / Float64(Float64(hypot(1.0, z) * y_m) * Float64(x_m * hypot(1.0, z))));
	else
		tmp = Float64(Float64(1.0 / y_m) / Float64(x_m * fma(z, z, 1.0)));
	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[y$95$m, 5.8e+141], N[(1.0 / N[(N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * y$95$m), $MachinePrecision] * N[(x$95$m * N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $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}\;y\_m \leq 5.8 \cdot 10^{+141}:\\
\;\;\;\;\frac{1}{\left(\mathsf{hypot}\left(1, z\right) \cdot y\_m\right) \cdot \left(x\_m \cdot \mathsf{hypot}\left(1, z\right)\right)}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 5.80000000000000013e141

    1. Initial program 89.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{y \cdot \left(x \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}\right)} \]
    3. Simplified88.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. *-commutative88.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{x}^{-0.5}}{\sqrt{y \cdot \color{blue}{\left(z \cdot z + 1\right)}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      12. fma-undefine15.6%

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

        \[\leadsto \frac{{x}^{-0.5}}{\sqrt{\color{blue}{\mathsf{fma}\left(z, z, 1\right) \cdot y}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      14. sqrt-prod15.6%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{y}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      15. fma-undefine15.6%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(z, z, 1\right)}}{x \cdot y}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt89.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\left(\frac{y}{1} \cdot \mathsf{hypot}\left(1, z\right)\right)} \cdot \frac{x}{\frac{1}{\mathsf{hypot}\left(1, z\right)}}} \]
      6. /-rgt-identity96.8%

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

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

        \[\leadsto \frac{1}{\left(\mathsf{hypot}\left(1, z\right) \cdot y\right) \cdot \color{blue}{\left(\frac{x}{1} \cdot \mathsf{hypot}\left(1, z\right)\right)}} \]
      9. /-rgt-identity96.8%

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

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

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

    if 5.80000000000000013e141 < y

    1. Initial program 91.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{y \cdot \left(x \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}\right)} \]
    3. Simplified100.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. *-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(z, z, 1\right)}}{x \cdot y}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt99.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{\sqrt{\color{blue}{1 + {z}^{2}}}}}{y} \cdot \frac{\sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right)}}}{x} \]
      11. metadata-eval97.0%

        \[\leadsto \frac{\frac{1}{\sqrt{\color{blue}{1 \cdot 1} + {z}^{2}}}}{y} \cdot \frac{\sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right)}}}{x} \]
      12. pow297.0%

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{y} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x}} \]
    12. Step-by-step derivation
      1. associate-*r/91.9%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{\sqrt{1 \cdot 1 + z \cdot z} \cdot \color{blue}{\sqrt{1 \cdot 1 + z \cdot z}}}}{y} \cdot \frac{1}{x} \]
      8. rem-square-sqrt91.8%

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

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

        \[\leadsto \frac{\frac{1}{\color{blue}{z \cdot z + 1}}}{y} \cdot \frac{1}{x} \]
      11. fma-undefine91.8%

        \[\leadsto \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(z, z, 1\right)}}}{y} \cdot \frac{1}{x} \]
      12. associate-/r*91.8%

        \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot y}} \cdot \frac{1}{x} \]
      13. associate-/l/91.8%

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

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

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

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

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

Alternative 2: 99.2% 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 {\left(\frac{\frac{{x\_m}^{-0.5}}{\mathsf{hypot}\left(1, z\right)}}{\sqrt{y\_m}}\right)}^{2}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 (/ (/ (pow x_m -0.5) (hypot 1.0 z)) (sqrt y_m)) 2.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) {
	return y_s * (x_s * pow(((pow(x_m, -0.5) / hypot(1.0, z)) / sqrt(y_m)), 2.0));
}
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(((Math.pow(x_m, -0.5) / Math.hypot(1.0, z)) / Math.sqrt(y_m)), 2.0));
}
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(((math.pow(x_m, -0.5) / math.hypot(1.0, z)) / math.sqrt(y_m)), 2.0))
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((x_m ^ -0.5) / hypot(1.0, z)) / sqrt(y_m)) ^ 2.0)))
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 * ((((x_m ^ -0.5) / hypot(1.0, z)) / sqrt(y_m)) ^ 2.0));
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[Power[N[(N[(N[Power[x$95$m, -0.5], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision], 2.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])\\
\\
y\_s \cdot \left(x\_s \cdot {\left(\frac{\frac{{x\_m}^{-0.5}}{\mathsf{hypot}\left(1, z\right)}}{\sqrt{y\_m}}\right)}^{2}\right)
\end{array}
Derivation
  1. Initial program 89.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{y \cdot \left(x \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}\right)} \]
  3. Simplified89.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. *-commutative89.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{x}}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
    8. inv-pow21.0%

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

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

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

      \[\leadsto \frac{{x}^{-0.5}}{\sqrt{y \cdot \color{blue}{\left(z \cdot z + 1\right)}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
    12. fma-undefine21.0%

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

      \[\leadsto \frac{{x}^{-0.5}}{\sqrt{\color{blue}{\mathsf{fma}\left(z, z, 1\right) \cdot y}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
    14. sqrt-prod21.0%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{y}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
    15. fma-undefine21.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 96.1% 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^{+304}:\\ \;\;\;\;\frac{\frac{1}{y\_m}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z \cdot y\_m} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x\_m}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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+304)
     (/ (/ 1.0 y_m) (* x_m (fma z z 1.0)))
     (* (/ 1.0 (* z y_m)) (/ (/ 1.0 (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) {
	double tmp;
	if ((z * z) <= 2e+304) {
		tmp = (1.0 / y_m) / (x_m * fma(z, z, 1.0));
	} else {
		tmp = (1.0 / (z * y_m)) * ((1.0 / hypot(1.0, z)) / x_m);
	}
	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+304)
		tmp = Float64(Float64(1.0 / y_m) / Float64(x_m * fma(z, z, 1.0)));
	else
		tmp = Float64(Float64(1.0 / Float64(z * y_m)) * Float64(Float64(1.0 / hypot(1.0, z)) / x_m));
	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+304], N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(z * y$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / 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 \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+304}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\

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


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

    1. Initial program 96.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. *-commutative96.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{x}}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      8. inv-pow21.0%

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

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

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

        \[\leadsto \frac{{x}^{-0.5}}{\sqrt{y \cdot \color{blue}{\left(z \cdot z + 1\right)}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      12. fma-undefine21.0%

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

        \[\leadsto \frac{{x}^{-0.5}}{\sqrt{\color{blue}{\mathsf{fma}\left(z, z, 1\right) \cdot y}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      14. sqrt-prod21.0%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{y}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      15. fma-undefine21.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(z, z, 1\right)}}{x \cdot y}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt97.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{y} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x}} \]
    12. Step-by-step derivation
      1. associate-*r/96.3%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{\sqrt{1 \cdot 1 + z \cdot z} \cdot \color{blue}{\sqrt{1 \cdot 1 + z \cdot z}}}}{y} \cdot \frac{1}{x} \]
      8. rem-square-sqrt96.3%

        \[\leadsto \frac{\frac{1}{\color{blue}{1 \cdot 1 + z \cdot z}}}{y} \cdot \frac{1}{x} \]
      9. metadata-eval96.3%

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

        \[\leadsto \frac{\frac{1}{\color{blue}{z \cdot z + 1}}}{y} \cdot \frac{1}{x} \]
      11. fma-undefine96.3%

        \[\leadsto \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(z, z, 1\right)}}}{y} \cdot \frac{1}{x} \]
      12. associate-/r*96.3%

        \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot y}} \cdot \frac{1}{x} \]
      13. associate-/l/96.3%

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

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

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

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

    if 1.9999999999999999e304 < (*.f64 z z)

    1. Initial program 65.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. *-commutative65.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(z, z, 1\right)}}{x \cdot y}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 92.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])\\ \\ \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^{+304}:\\ \;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{{z}^{2}}}{x\_m \cdot y\_m}\\ \end{array}\right) \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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+304)
       (/ (/ 1.0 x_m) t_0)
       (/ (/ 1.0 (pow z 2.0)) (* x_m 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) {
	double t_0 = y_m * (1.0 + (z * z));
	double tmp;
	if (t_0 <= 5e+304) {
		tmp = (1.0 / x_m) / t_0;
	} else {
		tmp = (1.0 / pow(z, 2.0)) / (x_m * y_m);
	}
	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+304) then
        tmp = (1.0d0 / x_m) / t_0
    else
        tmp = (1.0d0 / (z ** 2.0d0)) / (x_m * y_m)
    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+304) {
		tmp = (1.0 / x_m) / t_0;
	} else {
		tmp = (1.0 / Math.pow(z, 2.0)) / (x_m * y_m);
	}
	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+304:
		tmp = (1.0 / x_m) / t_0
	else:
		tmp = (1.0 / math.pow(z, 2.0)) / (x_m * y_m)
	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+304)
		tmp = Float64(Float64(1.0 / x_m) / t_0);
	else
		tmp = Float64(Float64(1.0 / (z ^ 2.0)) / Float64(x_m * y_m));
	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+304)
		tmp = (1.0 / x_m) / t_0;
	else
		tmp = (1.0 / (z ^ 2.0)) / (x_m * y_m);
	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+304], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / N[Power[z, 2.0], $MachinePrecision]), $MachinePrecision] / N[(x$95$m * 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])\\
\\
\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^{+304}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\

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


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 4.9999999999999997e304

    1. Initial program 95.3%

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

    if 4.9999999999999997e304 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 58.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(z, z, 1\right)}}{x \cdot y}} \]
    10. Taylor expanded in z around inf 69.4%

      \[\leadsto \frac{\color{blue}{\frac{1}{{z}^{2}}}}{x \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 91.3% 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 \leq 1850000:\\ \;\;\;\;\frac{\frac{1}{x\_m}}{y\_m \cdot \left(1 + z \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y\_m \cdot \left(x\_m \cdot {z}^{2}\right)}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 1850000.0)
     (/ (/ 1.0 x_m) (* y_m (+ 1.0 (* z z))))
     (/ 1.0 (* y_m (* x_m (pow z 2.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 tmp;
	if (z <= 1850000.0) {
		tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
	} else {
		tmp = 1.0 / (y_m * (x_m * pow(z, 2.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) :: tmp
    if (z <= 1850000.0d0) then
        tmp = (1.0d0 / x_m) / (y_m * (1.0d0 + (z * z)))
    else
        tmp = 1.0d0 / (y_m * (x_m * (z ** 2.0d0)))
    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 <= 1850000.0) {
		tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
	} else {
		tmp = 1.0 / (y_m * (x_m * Math.pow(z, 2.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):
	tmp = 0
	if z <= 1850000.0:
		tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)))
	else:
		tmp = 1.0 / (y_m * (x_m * math.pow(z, 2.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)
	tmp = 0.0
	if (z <= 1850000.0)
		tmp = Float64(Float64(1.0 / x_m) / Float64(y_m * Float64(1.0 + Float64(z * z))));
	else
		tmp = Float64(1.0 / Float64(y_m * Float64(x_m * (z ^ 2.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)
	tmp = 0.0;
	if (z <= 1850000.0)
		tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
	else
		tmp = 1.0 / (y_m * (x_m * (z ^ 2.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_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1850000.0], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(y$95$m * N[(x$95$m * N[Power[z, 2.0], $MachinePrecision]), $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 1850000:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m \cdot \left(1 + z \cdot z\right)}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.85e6

    1. Initial program 92.4%

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

    if 1.85e6 < z

    1. Initial program 78.7%

      \[\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. remove-double-neg77.2%

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

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

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

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

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

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

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

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

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

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

      \[\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 inf 77.2%

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

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

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

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

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

Alternative 6: 93.3% 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 \frac{\frac{1}{y\_m}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 (fma z z 1.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) {
	return y_s * (x_s * ((1.0 / y_m) / (x_m * fma(z, z, 1.0))));
}
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(x_m * fma(z, z, 1.0)))))
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[(x$95$m * N[(z * z + 1.0), $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 \frac{\frac{1}{y\_m}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\right)
\end{array}
Derivation
  1. Initial program 89.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{y \cdot \left(x \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}\right)} \]
  3. Simplified89.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. *-commutative89.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{x}}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
    8. inv-pow21.0%

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

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

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

      \[\leadsto \frac{{x}^{-0.5}}{\sqrt{y \cdot \color{blue}{\left(z \cdot z + 1\right)}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
    12. fma-undefine21.0%

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

      \[\leadsto \frac{{x}^{-0.5}}{\sqrt{\color{blue}{\mathsf{fma}\left(z, z, 1\right) \cdot y}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
    14. sqrt-prod21.0%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{y}}} \cdot \sqrt{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
    15. fma-undefine21.0%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(z, z, 1\right)}}{x \cdot y}} \]
  10. Step-by-step derivation
    1. add-sqr-sqrt90.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\sqrt{\color{blue}{1 + {z}^{2}}}}}{y} \cdot \frac{\sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right)}}}{x} \]
    11. metadata-eval90.0%

      \[\leadsto \frac{\frac{1}{\sqrt{\color{blue}{1 \cdot 1} + {z}^{2}}}}{y} \cdot \frac{\sqrt{\frac{1}{\mathsf{fma}\left(z, z, 1\right)}}}{x} \]
    12. pow290.0%

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

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

    \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{y} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x}} \]
  12. Step-by-step derivation
    1. associate-*r/94.0%

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\sqrt{1 \cdot 1 + z \cdot z} \cdot \color{blue}{\sqrt{1 \cdot 1 + z \cdot z}}}}{y} \cdot \frac{1}{x} \]
    8. rem-square-sqrt89.7%

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

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

      \[\leadsto \frac{\frac{1}{\color{blue}{z \cdot z + 1}}}{y} \cdot \frac{1}{x} \]
    11. fma-undefine89.7%

      \[\leadsto \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(z, z, 1\right)}}}{y} \cdot \frac{1}{x} \]
    12. associate-/r*89.7%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot y}} \cdot \frac{1}{x} \]
    13. associate-/l/89.7%

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

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

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

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

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

Alternative 7: 92.9% 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 \frac{1}{y\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 (fma z z 1.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) {
	return y_s * (x_s * (1.0 / (y_m * (x_m * fma(z, z, 1.0)))));
}
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 * Float64(x_m * fma(z, z, 1.0))))))
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 * N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $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 \frac{1}{y\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\right)
\end{array}
Derivation
  1. Initial program 89.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 89.5% accurate, 1.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{1}{x\_m}}{y\_m \cdot \left(1 + z \cdot z\right)}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 x_m) (* y_m (+ 1.0 (* 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) {
	return y_s * (x_s * ((1.0 / x_m) / (y_m * (1.0 + (z * z)))));
}
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 / x_m) / (y_m * (1.0d0 + (z * z)))))
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 / x_m) / (y_m * (1.0 + (z * z)))));
}
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 / x_m) / (y_m * (1.0 + (z * z)))))
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 / x_m) / Float64(y_m * Float64(1.0 + Float64(z * z))))))
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 / x_m) / (y_m * (1.0 + (z * z)))));
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 / x$95$m), $MachinePrecision] / N[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $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 \frac{\frac{1}{x\_m}}{y\_m \cdot \left(1 + z \cdot z\right)}\right)
\end{array}
Derivation
  1. Initial program 89.8%

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

Alternative 9: 58.3% 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}{x\_m \cdot y\_m}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 (* x_m 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 * (1.0 / (x_m * y_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 / (x_m * y_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 / (x_m * 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 * (1.0 / (x_m * 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(1.0 / Float64(x_m * 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 * (1.0 / (x_m * 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[(1.0 / N[(x$95$m * 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{1}{x\_m \cdot y\_m}\right)
\end{array}
Derivation
  1. Initial program 89.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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 68.8%

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

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

Developer Target 1: 93.3% 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 2024170 
(FPCore (x y z)
  :name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< (* y (+ 1 (* z z))) -inf.0) (/ (/ 1 y) (* (+ 1 (* z z)) x)) (if (< (* y (+ 1 (* z z))) 868074325056725200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (/ 1 x) (* (+ 1 (* z z)) y)) (/ (/ 1 y) (* (+ 1 (* z z)) x)))))

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