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

Percentage Accurate: 88.2% → 99.6%
Time: 12.4s
Alternatives: 13
Speedup: 0.7×

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

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

Initial Program: 88.2% 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.6% 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 := \frac{{x_m}^{-0.5}}{z}\\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+189}:\\ \;\;\;\;\frac{\frac{1}{\frac{\mathsf{fma}\left(z, z, 1\right)}{\frac{1}{x_m}}}}{y_m}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(t_0 \cdot \frac{1}{y_m}\right)\\ \end{array}\right) \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (/ (pow x_m -0.5) z)))
   (*
    y_s
    (*
     x_s
     (if (<= (* z z) 5e+189)
       (/ (/ 1.0 (/ (fma z z 1.0) (/ 1.0 x_m))) y_m)
       (* t_0 (* t_0 (/ 1.0 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 = pow(x_m, -0.5) / z;
	double tmp;
	if ((z * z) <= 5e+189) {
		tmp = (1.0 / (fma(z, z, 1.0) / (1.0 / x_m))) / y_m;
	} else {
		tmp = t_0 * (t_0 * (1.0 / 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((x_m ^ -0.5) / z)
	tmp = 0.0
	if (Float64(z * z) <= 5e+189)
		tmp = Float64(Float64(1.0 / Float64(fma(z, z, 1.0) / Float64(1.0 / x_m))) / y_m);
	else
		tmp = Float64(t_0 * Float64(t_0 * Float64(1.0 / y_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_] := Block[{t$95$0 = N[(N[Power[x$95$m, -0.5], $MachinePrecision] / z), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e+189], N[(N[(1.0 / N[(N[(z * z + 1.0), $MachinePrecision] / N[(1.0 / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(t$95$0 * N[(t$95$0 * N[(1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := \frac{{x_m}^{-0.5}}{z}\\
y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+189}:\\
\;\;\;\;\frac{\frac{1}{\frac{\mathsf{fma}\left(z, z, 1\right)}{\frac{1}{x_m}}}}{y_m}\\

\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(t_0 \cdot \frac{1}{y_m}\right)\\


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

    1. Initial program 98.6%

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{-1}{-1 \cdot x}}}{1 + z \cdot z}}{y} \]
      4. metadata-eval98.6%

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      6. distribute-neg-frac98.6%

        \[\leadsto \frac{\frac{\color{blue}{-\frac{1}{-x}}}{1 + z \cdot z}}{y} \]
      7. distribute-frac-neg98.6%

        \[\leadsto \frac{\color{blue}{-\frac{\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      8. distribute-frac-neg98.6%

        \[\leadsto \frac{\color{blue}{\frac{-\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      9. distribute-neg-frac98.6%

        \[\leadsto \frac{\frac{\color{blue}{\frac{-1}{-x}}}{1 + z \cdot z}}{y} \]
      10. metadata-eval98.6%

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{-1}{-1}}{x}}}{1 + z \cdot z}}{y} \]
      13. metadata-eval98.6%

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000004e189 < (*.f64 z z)

    1. Initial program 76.4%

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

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

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

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

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      6. distribute-neg-frac77.1%

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

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

        \[\leadsto \frac{\color{blue}{\frac{-\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      9. distribute-neg-frac77.1%

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{-1}{-1}}{x}}}{1 + z \cdot z}}{y} \]
      13. metadata-eval77.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}} \cdot \left(\sqrt{\frac{1}{x \cdot {z}^{2}}} \cdot \frac{1}{y}\right) \]
      11. add-sqr-sqrt37.9%

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

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

        \[\leadsto \frac{{x}^{-0.5}}{z} \cdot \left(\color{blue}{\frac{\sqrt{\frac{1}{x}}}{\sqrt{{z}^{2}}}} \cdot \frac{1}{y}\right) \]
      14. inv-pow37.9%

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

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

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

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

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

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

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

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

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

    \[\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{\frac{\frac{1}{x}}{1 + z \cdot z}}{y}} \]
    2. metadata-eval91.9%

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

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

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

      \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
    6. distribute-neg-frac91.9%

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

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

      \[\leadsto \frac{\color{blue}{\frac{-\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
    9. distribute-neg-frac91.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 87.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}\;z \cdot z \leq 1000000000000:\\ \;\;\;\;\frac{\frac{\frac{1}{y_m}}{x_m}}{\mathsf{fma}\left(z, z, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{1}{z \cdot x_m}}{y_m}\\ \end{array}\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= (* z z) 1000000000000.0)
     (/ (/ (/ 1.0 y_m) x_m) (fma z z 1.0))
     (/ (* (/ 1.0 (hypot 1.0 z)) (/ 1.0 (* z 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 tmp;
	if ((z * z) <= 1000000000000.0) {
		tmp = ((1.0 / y_m) / x_m) / fma(z, z, 1.0);
	} else {
		tmp = ((1.0 / hypot(1.0, z)) * (1.0 / (z * 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)
	tmp = 0.0
	if (Float64(z * z) <= 1000000000000.0)
		tmp = Float64(Float64(Float64(1.0 / y_m) / x_m) / fma(z, z, 1.0));
	else
		tmp = Float64(Float64(Float64(1.0 / hypot(1.0, z)) * Float64(1.0 / Float64(z * x_m))) / y_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], 1000000000000.0], N[(N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision] / N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(z * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $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 1000000000000:\\
\;\;\;\;\frac{\frac{\frac{1}{y_m}}{x_m}}{\mathsf{fma}\left(z, z, 1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{1}{z \cdot x_m}}{y_m}\\


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e12 < (*.f64 z z)

    1. Initial program 83.2%

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

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

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

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

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      6. distribute-neg-frac83.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 94.2% accurate, 0.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+238}:\\ \;\;\;\;\frac{\frac{1}{\frac{\mathsf{fma}\left(z, z, 1\right)}{\frac{1}{x_m}}}}{y_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z \cdot x_m}}{\mathsf{hypot}\left(1, z\right) \cdot y_m}\\ \end{array}\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= (* z z) 5e+238)
     (/ (/ 1.0 (/ (fma z z 1.0) (/ 1.0 x_m))) y_m)
     (/ (/ 1.0 (* z x_m)) (* (hypot 1.0 z) 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 tmp;
	if ((z * z) <= 5e+238) {
		tmp = (1.0 / (fma(z, z, 1.0) / (1.0 / x_m))) / y_m;
	} else {
		tmp = (1.0 / (z * x_m)) / (hypot(1.0, z) * 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)
	tmp = 0.0
	if (Float64(z * z) <= 5e+238)
		tmp = Float64(Float64(1.0 / Float64(fma(z, z, 1.0) / Float64(1.0 / x_m))) / y_m);
	else
		tmp = Float64(Float64(1.0 / Float64(z * x_m)) / Float64(hypot(1.0, z) * y_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], 5e+238], N[(N[(1.0 / N[(N[(z * z + 1.0), $MachinePrecision] / N[(1.0 / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(1.0 / N[(z * x$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * 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 \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+238}:\\
\;\;\;\;\frac{\frac{1}{\frac{\mathsf{fma}\left(z, z, 1\right)}{\frac{1}{x_m}}}}{y_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z \cdot x_m}}{\mathsf{hypot}\left(1, z\right) \cdot y_m}\\


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

    1. Initial program 97.3%

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{-1}{-1 \cdot x}}}{1 + z \cdot z}}{y} \]
      4. metadata-eval97.6%

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      6. distribute-neg-frac97.6%

        \[\leadsto \frac{\frac{\color{blue}{-\frac{1}{-x}}}{1 + z \cdot z}}{y} \]
      7. distribute-frac-neg97.6%

        \[\leadsto \frac{\color{blue}{-\frac{\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      8. distribute-frac-neg97.6%

        \[\leadsto \frac{\color{blue}{\frac{-\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      9. distribute-neg-frac97.6%

        \[\leadsto \frac{\frac{\color{blue}{\frac{-1}{-x}}}{1 + z \cdot z}}{y} \]
      10. metadata-eval97.6%

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{-1}{-1}}{x}}}{1 + z \cdot z}}{y} \]
      13. metadata-eval97.6%

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999995e238 < (*.f64 z z)

    1. Initial program 77.2%

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

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

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

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

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      6. distribute-neg-frac77.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)} \cdot \color{blue}{\frac{1}{x \cdot z}}}{y} \]
    8. Step-by-step derivation
      1. expm1-log1p-u74.5%

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{1}{x \cdot z}}{y}\right)} - 1} \]
      3. div-inv73.0%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1 \cdot \frac{1}{x \cdot z}}{\mathsf{hypot}\left(1, z\right)}} \cdot \frac{1}{y}\right)} - 1 \]
      5. *-un-lft-identity73.0%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{1}{\frac{x \cdot z}{1}}}}{\mathsf{hypot}\left(1, z\right) \cdot y}\right)} - 1 \]
      8. clear-num73.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{1}{x \cdot z}}}{\mathsf{hypot}\left(1, z\right) \cdot y}\right)} - 1 \]
      9. associate-/r*73.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{\frac{1}{x}}{z}}}{\mathsf{hypot}\left(1, z\right) \cdot y}\right)} - 1 \]
    9. Applied egg-rr73.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{\frac{1}{x}}{z}}{\mathsf{hypot}\left(1, z\right) \cdot y}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def78.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{\frac{1}{x}}{z}}{\mathsf{hypot}\left(1, z\right) \cdot y}\right)\right)} \]
      2. expm1-log1p79.5%

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

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

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

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

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

Alternative 5: 94.2% accurate, 0.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+238}:\\ \;\;\;\;\frac{\frac{1}{x_m \cdot \mathsf{fma}\left(z, z, 1\right)}}{y_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z \cdot x_m}}{\mathsf{hypot}\left(1, z\right) \cdot y_m}\\ \end{array}\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= (* z z) 5e+238)
     (/ (/ 1.0 (* x_m (fma z z 1.0))) y_m)
     (/ (/ 1.0 (* z x_m)) (* (hypot 1.0 z) 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 tmp;
	if ((z * z) <= 5e+238) {
		tmp = (1.0 / (x_m * fma(z, z, 1.0))) / y_m;
	} else {
		tmp = (1.0 / (z * x_m)) / (hypot(1.0, z) * 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)
	tmp = 0.0
	if (Float64(z * z) <= 5e+238)
		tmp = Float64(Float64(1.0 / Float64(x_m * fma(z, z, 1.0))) / y_m);
	else
		tmp = Float64(Float64(1.0 / Float64(z * x_m)) / Float64(hypot(1.0, z) * y_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], 5e+238], N[(N[(1.0 / N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(1.0 / N[(z * x$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * 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 \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+238}:\\
\;\;\;\;\frac{\frac{1}{x_m \cdot \mathsf{fma}\left(z, z, 1\right)}}{y_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z \cdot x_m}}{\mathsf{hypot}\left(1, z\right) \cdot y_m}\\


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

    1. Initial program 97.3%

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{-1}{-1 \cdot x}}}{1 + z \cdot z}}{y} \]
      4. metadata-eval97.6%

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      6. distribute-neg-frac97.6%

        \[\leadsto \frac{\frac{\color{blue}{-\frac{1}{-x}}}{1 + z \cdot z}}{y} \]
      7. distribute-frac-neg97.6%

        \[\leadsto \frac{\color{blue}{-\frac{\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      8. distribute-frac-neg97.6%

        \[\leadsto \frac{\color{blue}{\frac{-\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      9. distribute-neg-frac97.6%

        \[\leadsto \frac{\frac{\color{blue}{\frac{-1}{-x}}}{1 + z \cdot z}}{y} \]
      10. metadata-eval97.6%

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{-1}{-1}}{x}}}{1 + z \cdot z}}{y} \]
      13. metadata-eval97.6%

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

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

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

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

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

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

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

    if 4.99999999999999995e238 < (*.f64 z z)

    1. Initial program 77.2%

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

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

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

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

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      6. distribute-neg-frac77.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)} \cdot \color{blue}{\frac{1}{x \cdot z}}}{y} \]
    8. Step-by-step derivation
      1. expm1-log1p-u74.5%

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{1}{x \cdot z}}{y}\right)} - 1} \]
      3. div-inv73.0%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1 \cdot \frac{1}{x \cdot z}}{\mathsf{hypot}\left(1, z\right)}} \cdot \frac{1}{y}\right)} - 1 \]
      5. *-un-lft-identity73.0%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{1}{\frac{x \cdot z}{1}}}}{\mathsf{hypot}\left(1, z\right) \cdot y}\right)} - 1 \]
      8. clear-num73.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{1}{x \cdot z}}}{\mathsf{hypot}\left(1, z\right) \cdot y}\right)} - 1 \]
      9. associate-/r*73.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{\frac{1}{x}}{z}}}{\mathsf{hypot}\left(1, z\right) \cdot y}\right)} - 1 \]
    9. Applied egg-rr73.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{\frac{1}{x}}{z}}{\mathsf{hypot}\left(1, z\right) \cdot y}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def78.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{\frac{1}{x}}{z}}{\mathsf{hypot}\left(1, z\right) \cdot y}\right)\right)} \]
      2. expm1-log1p79.5%

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

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

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

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

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

Alternative 6: 98.6% 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 1000000000000:\\ \;\;\;\;\frac{\frac{\frac{1}{y_m}}{x_m}}{\mathsf{fma}\left(z, z, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{x_m}}{z}}{y_m}\\ \end{array}\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= (* z z) 1000000000000.0)
     (/ (/ (/ 1.0 y_m) x_m) (fma z z 1.0))
     (/ (* (/ 1.0 z) (/ (/ 1.0 x_m) z)) 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 tmp;
	if ((z * z) <= 1000000000000.0) {
		tmp = ((1.0 / y_m) / x_m) / fma(z, z, 1.0);
	} else {
		tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / 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)
	tmp = 0.0
	if (Float64(z * z) <= 1000000000000.0)
		tmp = Float64(Float64(Float64(1.0 / y_m) / x_m) / fma(z, z, 1.0));
	else
		tmp = Float64(Float64(Float64(1.0 / z) * Float64(Float64(1.0 / x_m) / z)) / y_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], 1000000000000.0], N[(N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision] / N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / y$95$m), $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 1000000000000:\\
\;\;\;\;\frac{\frac{\frac{1}{y_m}}{x_m}}{\mathsf{fma}\left(z, z, 1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{x_m}}{z}}{y_m}\\


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e12 < (*.f64 z z)

    1. Initial program 83.2%

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

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

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

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

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      6. distribute-neg-frac83.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\color{blue}{x \cdot {z}^{2}}}}{y} \]
    6. Step-by-step derivation
      1. associate-/r*83.7%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{{z}^{2}}}}{y} \]
      2. *-un-lft-identity83.7%

        \[\leadsto \frac{\frac{\color{blue}{1 \cdot \frac{1}{x}}}{{z}^{2}}}{y} \]
      3. unpow283.7%

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

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

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

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

Alternative 7: 98.6% accurate, 0.7× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+33}:\\ \;\;\;\;\frac{\frac{1}{x_m}}{y_m \cdot \left(1 + z \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{x_m}}{z}}{y_m}\\ \end{array}\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= (* z z) 2e+33)
     (/ (/ 1.0 x_m) (* y_m (+ 1.0 (* z z))))
     (/ (* (/ 1.0 z) (/ (/ 1.0 x_m) z)) 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 tmp;
	if ((z * z) <= 2e+33) {
		tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
	} else {
		tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / 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) :: tmp
    if ((z * z) <= 2d+33) then
        tmp = (1.0d0 / x_m) / (y_m * (1.0d0 + (z * z)))
    else
        tmp = ((1.0d0 / z) * ((1.0d0 / x_m) / z)) / 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 tmp;
	if ((z * z) <= 2e+33) {
		tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
	} else {
		tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / 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):
	tmp = 0
	if (z * z) <= 2e+33:
		tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)))
	else:
		tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / 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)
	tmp = 0.0
	if (Float64(z * z) <= 2e+33)
		tmp = Float64(Float64(1.0 / x_m) / Float64(y_m * Float64(1.0 + Float64(z * z))));
	else
		tmp = Float64(Float64(Float64(1.0 / z) * Float64(Float64(1.0 / x_m) / z)) / 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)
	tmp = 0.0;
	if ((z * z) <= 2e+33)
		tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
	else
		tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / 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_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e+33], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / y$95$m), $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^{+33}:\\
\;\;\;\;\frac{\frac{1}{x_m}}{y_m \cdot \left(1 + z \cdot z\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{x_m}}{z}}{y_m}\\


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

    1. Initial program 99.7%

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

    if 1.9999999999999999e33 < (*.f64 z z)

    1. Initial program 82.5%

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

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

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

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

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      6. distribute-neg-frac83.1%

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

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

        \[\leadsto \frac{\color{blue}{\frac{-\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      9. distribute-neg-frac83.1%

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{-1}{-1}}{x}}}{1 + z \cdot z}}{y} \]
      13. metadata-eval83.1%

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\color{blue}{x \cdot {z}^{2}}}}{y} \]
    6. Step-by-step derivation
      1. associate-/r*83.1%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{{z}^{2}}}}{y} \]
      2. *-un-lft-identity83.1%

        \[\leadsto \frac{\frac{\color{blue}{1 \cdot \frac{1}{x}}}{{z}^{2}}}{y} \]
      3. unpow283.1%

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

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

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

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

Alternative 8: 77.9% accurate, 0.8× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z \leq 1:\\ \;\;\;\;\frac{\frac{1}{y_m}}{x_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x_m}}{z} \cdot \frac{\frac{1}{z}}{y_m}\\ \end{array}\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= z 1.0)
     (/ (/ 1.0 y_m) x_m)
     (* (/ (/ 1.0 x_m) z) (/ (/ 1.0 z) 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 tmp;
	if (z <= 1.0) {
		tmp = (1.0 / y_m) / x_m;
	} else {
		tmp = ((1.0 / x_m) / z) * ((1.0 / z) / 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) :: tmp
    if (z <= 1.0d0) then
        tmp = (1.0d0 / y_m) / x_m
    else
        tmp = ((1.0d0 / x_m) / z) * ((1.0d0 / z) / 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 tmp;
	if (z <= 1.0) {
		tmp = (1.0 / y_m) / x_m;
	} else {
		tmp = ((1.0 / x_m) / z) * ((1.0 / z) / 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):
	tmp = 0
	if z <= 1.0:
		tmp = (1.0 / y_m) / x_m
	else:
		tmp = ((1.0 / x_m) / z) * ((1.0 / z) / 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)
	tmp = 0.0
	if (z <= 1.0)
		tmp = Float64(Float64(1.0 / y_m) / x_m);
	else
		tmp = Float64(Float64(Float64(1.0 / x_m) / z) * Float64(Float64(1.0 / z) / 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)
	tmp = 0.0;
	if (z <= 1.0)
		tmp = (1.0 / y_m) / x_m;
	else
		tmp = ((1.0 / x_m) / z) * ((1.0 / z) / 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_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / 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 \begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y_m}}{x_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x_m}}{z} \cdot \frac{\frac{1}{z}}{y_m}\\


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

    1. Initial program 93.4%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{x \cdot y}} \]
    6. Step-by-step derivation
      1. *-commutative71.9%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    7. Simplified72.3%

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

    if 1 < z

    1. Initial program 85.4%

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

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

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

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

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      6. distribute-neg-frac86.4%

        \[\leadsto \frac{\frac{\color{blue}{-\frac{1}{-x}}}{1 + z \cdot z}}{y} \]
      7. distribute-frac-neg86.4%

        \[\leadsto \frac{\color{blue}{-\frac{\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      8. distribute-frac-neg86.4%

        \[\leadsto \frac{\color{blue}{\frac{-\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      9. distribute-neg-frac86.4%

        \[\leadsto \frac{\frac{\color{blue}{\frac{-1}{-x}}}{1 + z \cdot z}}{y} \]
      10. metadata-eval86.4%

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{-1}{-1}}{x}}}{1 + z \cdot z}}{y} \]
      13. metadata-eval86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\color{blue}{\left(\sqrt{x} \cdot z\right)}}^{-2}}{y} \]
      2. unpow-prod-down42.3%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{{z}^{-2}}{x}}}{y} \]
    14. Step-by-step derivation
      1. associate-/l/88.7%

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

        \[\leadsto \frac{\color{blue}{\sqrt{{z}^{-2}} \cdot \sqrt{{z}^{-2}}}}{y \cdot x} \]
      3. times-frac86.9%

        \[\leadsto \color{blue}{\frac{\sqrt{{z}^{-2}}}{y} \cdot \frac{\sqrt{{z}^{-2}}}{x}} \]
      4. sqrt-pow186.9%

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

        \[\leadsto \frac{{z}^{\color{blue}{-1}}}{y} \cdot \frac{\sqrt{{z}^{-2}}}{x} \]
      6. unpow-186.9%

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

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

        \[\leadsto \frac{\frac{1}{z}}{y} \cdot \frac{{z}^{\color{blue}{-1}}}{x} \]
      9. unpow-196.8%

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

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

        \[\leadsto \frac{\frac{1}{z}}{y} \cdot \color{blue}{\frac{\frac{1}{x}}{z}} \]
    15. Applied egg-rr96.8%

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

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

Alternative 9: 78.5% accurate, 0.8× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z \leq 1:\\ \;\;\;\;\frac{\frac{1}{y_m}}{x_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{x_m}}{z}}{y_m}\\ \end{array}\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= z 1.0)
     (/ (/ 1.0 y_m) x_m)
     (/ (* (/ 1.0 z) (/ (/ 1.0 x_m) z)) 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 tmp;
	if (z <= 1.0) {
		tmp = (1.0 / y_m) / x_m;
	} else {
		tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / 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) :: tmp
    if (z <= 1.0d0) then
        tmp = (1.0d0 / y_m) / x_m
    else
        tmp = ((1.0d0 / z) * ((1.0d0 / x_m) / z)) / 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 tmp;
	if (z <= 1.0) {
		tmp = (1.0 / y_m) / x_m;
	} else {
		tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / 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):
	tmp = 0
	if z <= 1.0:
		tmp = (1.0 / y_m) / x_m
	else:
		tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / 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)
	tmp = 0.0
	if (z <= 1.0)
		tmp = Float64(Float64(1.0 / y_m) / x_m);
	else
		tmp = Float64(Float64(Float64(1.0 / z) * Float64(Float64(1.0 / x_m) / z)) / 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)
	tmp = 0.0;
	if (z <= 1.0)
		tmp = (1.0 / y_m) / x_m;
	else
		tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / 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_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / y$95$m), $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 1:\\
\;\;\;\;\frac{\frac{1}{y_m}}{x_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{x_m}}{z}}{y_m}\\


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

    1. Initial program 93.4%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{x \cdot y}} \]
    6. Step-by-step derivation
      1. *-commutative71.9%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    7. Simplified72.3%

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

    if 1 < z

    1. Initial program 85.4%

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

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

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

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

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      6. distribute-neg-frac86.4%

        \[\leadsto \frac{\frac{\color{blue}{-\frac{1}{-x}}}{1 + z \cdot z}}{y} \]
      7. distribute-frac-neg86.4%

        \[\leadsto \frac{\color{blue}{-\frac{\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      8. distribute-frac-neg86.4%

        \[\leadsto \frac{\color{blue}{\frac{-\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      9. distribute-neg-frac86.4%

        \[\leadsto \frac{\frac{\color{blue}{\frac{-1}{-x}}}{1 + z \cdot z}}{y} \]
      10. metadata-eval86.4%

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{-1}{-1}}{x}}}{1 + z \cdot z}}{y} \]
      13. metadata-eval86.4%

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\color{blue}{x \cdot {z}^{2}}}}{y} \]
    6. Step-by-step derivation
      1. associate-/r*85.4%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{{z}^{2}}}}{y} \]
      2. *-un-lft-identity85.4%

        \[\leadsto \frac{\frac{\color{blue}{1 \cdot \frac{1}{x}}}{{z}^{2}}}{y} \]
      3. unpow285.4%

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

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

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

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

Alternative 10: 65.6% accurate, 1.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 \begin{array}{l} \mathbf{if}\;z \leq 1:\\ \;\;\;\;\frac{\frac{1}{y_m}}{x_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x_m \cdot \left(z \cdot y_m\right)}\\ \end{array}\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (if (<= z 1.0) (/ (/ 1.0 y_m) x_m) (/ 1.0 (* x_m (* z 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 tmp;
	if (z <= 1.0) {
		tmp = (1.0 / y_m) / x_m;
	} else {
		tmp = 1.0 / (x_m * (z * 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) :: tmp
    if (z <= 1.0d0) then
        tmp = (1.0d0 / y_m) / x_m
    else
        tmp = 1.0d0 / (x_m * (z * 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 tmp;
	if (z <= 1.0) {
		tmp = (1.0 / y_m) / x_m;
	} else {
		tmp = 1.0 / (x_m * (z * 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):
	tmp = 0
	if z <= 1.0:
		tmp = (1.0 / y_m) / x_m
	else:
		tmp = 1.0 / (x_m * (z * 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)
	tmp = 0.0
	if (z <= 1.0)
		tmp = Float64(Float64(1.0 / y_m) / x_m);
	else
		tmp = Float64(1.0 / Float64(x_m * Float64(z * 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)
	tmp = 0.0;
	if (z <= 1.0)
		tmp = (1.0 / y_m) / x_m;
	else
		tmp = 1.0 / (x_m * (z * 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_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(1.0 / N[(x$95$m * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y_m}}{x_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{x_m \cdot \left(z \cdot y_m\right)}\\


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

    1. Initial program 93.4%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{x \cdot y}} \]
    6. Step-by-step derivation
      1. *-commutative71.9%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    7. Simplified72.3%

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

    if 1 < z

    1. Initial program 85.4%

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

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

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

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

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      6. distribute-neg-frac86.4%

        \[\leadsto \frac{\frac{\color{blue}{-\frac{1}{-x}}}{1 + z \cdot z}}{y} \]
      7. distribute-frac-neg86.4%

        \[\leadsto \frac{\color{blue}{-\frac{\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      8. distribute-frac-neg86.4%

        \[\leadsto \frac{\color{blue}{\frac{-\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
      9. distribute-neg-frac86.4%

        \[\leadsto \frac{\frac{\color{blue}{\frac{-1}{-x}}}{1 + z \cdot z}}{y} \]
      10. metadata-eval86.4%

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{-1}{-1}}{x}}}{1 + z \cdot z}}{y} \]
      13. metadata-eval86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 58.2% 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 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (/ 1.0 (* 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 91.6%

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

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

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

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

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

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

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

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

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

Alternative 12: 58.1% 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{\frac{1}{x_m}}{y_m}\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (/ (/ 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(Float64(1.0 / 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[(N[(1.0 / x$95$m), $MachinePrecision] / y$95$m), $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}\right)
\end{array}
Derivation
  1. Initial program 91.6%

    \[\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{\frac{\frac{1}{x}}{1 + z \cdot z}}{y}} \]
    2. metadata-eval91.9%

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

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

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

      \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
    6. distribute-neg-frac91.9%

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

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

      \[\leadsto \frac{\color{blue}{\frac{-\frac{1}{-x}}{1 + z \cdot z}}}{y} \]
    9. distribute-neg-frac91.9%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\frac{1}{\color{blue}{x}}}{y} \]
  6. Final simplification60.2%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{x \cdot y}} \]
  6. Step-by-step derivation
    1. *-commutative59.9%

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

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
  7. Simplified60.2%

    \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
  8. Final simplification60.2%

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

Developer target: 93.0% accurate, 0.4× 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 2024010 
(FPCore (x y z)
  :name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
  :precision binary64

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

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