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

Percentage Accurate: 89.8% → 99.2%
Time: 11.3s
Alternatives: 10
Speedup: 0.8×

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

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

Initial Program: 89.8% 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.2% accurate, 0.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\ \\ \begin{array}{l} t_0 := y\_m \cdot \left(1 + z\_m \cdot z\_m\right)\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 5 \cdot 10^{+301}:\\ \;\;\;\;\frac{\frac{1}{x}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sqrt{\frac{1}{y\_m}}}{z\_m}}{\left(\mathsf{hypot}\left(1, z\_m\right) \cdot \sqrt{y\_m}\right) \cdot x}\\ \end{array} \end{array} \end{array} \]
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z_m)
 :precision binary64
 (let* ((t_0 (* y_m (+ 1.0 (* z_m z_m)))))
   (*
    y_s
    (if (<= t_0 5e+301)
      (/ (/ 1.0 x) t_0)
      (/ (/ (sqrt (/ 1.0 y_m)) z_m) (* (* (hypot 1.0 z_m) (sqrt y_m)) x))))))
z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z_m);
double code(double y_s, double x, double y_m, double z_m) {
	double t_0 = y_m * (1.0 + (z_m * z_m));
	double tmp;
	if (t_0 <= 5e+301) {
		tmp = (1.0 / x) / t_0;
	} else {
		tmp = (sqrt((1.0 / y_m)) / z_m) / ((hypot(1.0, z_m) * sqrt(y_m)) * x);
	}
	return y_s * tmp;
}
z_m = Math.abs(z);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z_m;
public static double code(double y_s, double x, double y_m, double z_m) {
	double t_0 = y_m * (1.0 + (z_m * z_m));
	double tmp;
	if (t_0 <= 5e+301) {
		tmp = (1.0 / x) / t_0;
	} else {
		tmp = (Math.sqrt((1.0 / y_m)) / z_m) / ((Math.hypot(1.0, z_m) * Math.sqrt(y_m)) * x);
	}
	return y_s * tmp;
}
z_m = math.fabs(z)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x, y_m, z_m] = sort([x, y_m, z_m])
def code(y_s, x, y_m, z_m):
	t_0 = y_m * (1.0 + (z_m * z_m))
	tmp = 0
	if t_0 <= 5e+301:
		tmp = (1.0 / x) / t_0
	else:
		tmp = (math.sqrt((1.0 / y_m)) / z_m) / ((math.hypot(1.0, z_m) * math.sqrt(y_m)) * x)
	return y_s * tmp
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x, y_m, z_m = sort([x, y_m, z_m])
function code(y_s, x, y_m, z_m)
	t_0 = Float64(y_m * Float64(1.0 + Float64(z_m * z_m)))
	tmp = 0.0
	if (t_0 <= 5e+301)
		tmp = Float64(Float64(1.0 / x) / t_0);
	else
		tmp = Float64(Float64(sqrt(Float64(1.0 / y_m)) / z_m) / Float64(Float64(hypot(1.0, z_m) * sqrt(y_m)) * x));
	end
	return Float64(y_s * tmp)
end
z_m = abs(z);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z_m = num2cell(sort([x, y_m, z_m])){:}
function tmp_2 = code(y_s, x, y_m, z_m)
	t_0 = y_m * (1.0 + (z_m * z_m));
	tmp = 0.0;
	if (t_0 <= 5e+301)
		tmp = (1.0 / x) / t_0;
	else
		tmp = (sqrt((1.0 / y_m)) / z_m) / ((hypot(1.0, z_m) * sqrt(y_m)) * x);
	end
	tmp_2 = y_s * tmp;
end
z_m = N[Abs[z], $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, y_m, and z_m should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z$95$m_] := Block[{t$95$0 = N[(y$95$m * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, 5e+301], N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / y$95$m), $MachinePrecision]], $MachinePrecision] / z$95$m), $MachinePrecision] / N[(N[(N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision] * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
\begin{array}{l}
t_0 := y\_m \cdot \left(1 + z\_m \cdot z\_m\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+301}:\\
\;\;\;\;\frac{\frac{1}{x}}{t\_0}\\

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


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

    1. Initial program 94.3%

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

    if 5.0000000000000004e301 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.4% accurate, 0.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\ \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(1, z\_m\right) \cdot \sqrt{y\_m}\\ y\_s \cdot \frac{\frac{1}{t\_0}}{t\_0 \cdot x} \end{array} \end{array} \]
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z_m)
 :precision binary64
 (let* ((t_0 (* (hypot 1.0 z_m) (sqrt y_m))))
   (* y_s (/ (/ 1.0 t_0) (* t_0 x)))))
z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z_m);
double code(double y_s, double x, double y_m, double z_m) {
	double t_0 = hypot(1.0, z_m) * sqrt(y_m);
	return y_s * ((1.0 / t_0) / (t_0 * x));
}
z_m = Math.abs(z);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z_m;
public static double code(double y_s, double x, double y_m, double z_m) {
	double t_0 = Math.hypot(1.0, z_m) * Math.sqrt(y_m);
	return y_s * ((1.0 / t_0) / (t_0 * x));
}
z_m = math.fabs(z)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x, y_m, z_m] = sort([x, y_m, z_m])
def code(y_s, x, y_m, z_m):
	t_0 = math.hypot(1.0, z_m) * math.sqrt(y_m)
	return y_s * ((1.0 / t_0) / (t_0 * x))
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x, y_m, z_m = sort([x, y_m, z_m])
function code(y_s, x, y_m, z_m)
	t_0 = Float64(hypot(1.0, z_m) * sqrt(y_m))
	return Float64(y_s * Float64(Float64(1.0 / t_0) / Float64(t_0 * x)))
end
z_m = abs(z);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z_m = num2cell(sort([x, y_m, z_m])){:}
function tmp = code(y_s, x, y_m, z_m)
	t_0 = hypot(1.0, z_m) * sqrt(y_m);
	tmp = y_s * ((1.0 / t_0) / (t_0 * x));
end
z_m = N[Abs[z], $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, y_m, and z_m should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z$95$m_] := Block[{t$95$0 = N[(N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision] * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(N[(1.0 / t$95$0), $MachinePrecision] / N[(t$95$0 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, z\_m\right) \cdot \sqrt{y\_m}\\
y\_s \cdot \frac{\frac{1}{t\_0}}{t\_0 \cdot x}
\end{array}
\end{array}
Derivation
  1. Initial program 92.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.2% accurate, 0.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\ \\ \begin{array}{l} t_0 := y\_m \cdot \left(1 + z\_m \cdot z\_m\right)\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 2 \cdot 10^{+305}:\\ \;\;\;\;\frac{\frac{1}{x}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(1, z\_m\right) \cdot \sqrt{y\_m}}}{\sqrt{y\_m} \cdot \left(z\_m \cdot x\right)}\\ \end{array} \end{array} \end{array} \]
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z_m)
 :precision binary64
 (let* ((t_0 (* y_m (+ 1.0 (* z_m z_m)))))
   (*
    y_s
    (if (<= t_0 2e+305)
      (/ (/ 1.0 x) t_0)
      (/ (/ 1.0 (* (hypot 1.0 z_m) (sqrt y_m))) (* (sqrt y_m) (* z_m x)))))))
z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z_m);
double code(double y_s, double x, double y_m, double z_m) {
	double t_0 = y_m * (1.0 + (z_m * z_m));
	double tmp;
	if (t_0 <= 2e+305) {
		tmp = (1.0 / x) / t_0;
	} else {
		tmp = (1.0 / (hypot(1.0, z_m) * sqrt(y_m))) / (sqrt(y_m) * (z_m * x));
	}
	return y_s * tmp;
}
z_m = Math.abs(z);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z_m;
public static double code(double y_s, double x, double y_m, double z_m) {
	double t_0 = y_m * (1.0 + (z_m * z_m));
	double tmp;
	if (t_0 <= 2e+305) {
		tmp = (1.0 / x) / t_0;
	} else {
		tmp = (1.0 / (Math.hypot(1.0, z_m) * Math.sqrt(y_m))) / (Math.sqrt(y_m) * (z_m * x));
	}
	return y_s * tmp;
}
z_m = math.fabs(z)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x, y_m, z_m] = sort([x, y_m, z_m])
def code(y_s, x, y_m, z_m):
	t_0 = y_m * (1.0 + (z_m * z_m))
	tmp = 0
	if t_0 <= 2e+305:
		tmp = (1.0 / x) / t_0
	else:
		tmp = (1.0 / (math.hypot(1.0, z_m) * math.sqrt(y_m))) / (math.sqrt(y_m) * (z_m * x))
	return y_s * tmp
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x, y_m, z_m = sort([x, y_m, z_m])
function code(y_s, x, y_m, z_m)
	t_0 = Float64(y_m * Float64(1.0 + Float64(z_m * z_m)))
	tmp = 0.0
	if (t_0 <= 2e+305)
		tmp = Float64(Float64(1.0 / x) / t_0);
	else
		tmp = Float64(Float64(1.0 / Float64(hypot(1.0, z_m) * sqrt(y_m))) / Float64(sqrt(y_m) * Float64(z_m * x)));
	end
	return Float64(y_s * tmp)
end
z_m = abs(z);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z_m = num2cell(sort([x, y_m, z_m])){:}
function tmp_2 = code(y_s, x, y_m, z_m)
	t_0 = y_m * (1.0 + (z_m * z_m));
	tmp = 0.0;
	if (t_0 <= 2e+305)
		tmp = (1.0 / x) / t_0;
	else
		tmp = (1.0 / (hypot(1.0, z_m) * sqrt(y_m))) / (sqrt(y_m) * (z_m * x));
	end
	tmp_2 = y_s * tmp;
end
z_m = N[Abs[z], $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, y_m, and z_m should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z$95$m_] := Block[{t$95$0 = N[(y$95$m * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, 2e+305], N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision] * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[y$95$m], $MachinePrecision] * N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
\begin{array}{l}
t_0 := y\_m \cdot \left(1 + z\_m \cdot z\_m\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+305}:\\
\;\;\;\;\frac{\frac{1}{x}}{t\_0}\\

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


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

    1. Initial program 94.3%

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

    if 1.9999999999999999e305 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.9% accurate, 0.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\ \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \cdot z\_m \leq 10^{+242}:\\ \;\;\;\;\frac{1}{y\_m} \cdot \frac{\frac{1}{x}}{\mathsf{fma}\left(z\_m, z\_m, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(z\_m \cdot x\right) \cdot \left(z\_m \cdot y\_m\right)}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z_m)
 :precision binary64
 (*
  y_s
  (if (<= (* z_m z_m) 1e+242)
    (* (/ 1.0 y_m) (/ (/ 1.0 x) (fma z_m z_m 1.0)))
    (/ 1.0 (* (* z_m x) (* z_m y_m))))))
z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z_m);
double code(double y_s, double x, double y_m, double z_m) {
	double tmp;
	if ((z_m * z_m) <= 1e+242) {
		tmp = (1.0 / y_m) * ((1.0 / x) / fma(z_m, z_m, 1.0));
	} else {
		tmp = 1.0 / ((z_m * x) * (z_m * y_m));
	}
	return y_s * tmp;
}
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x, y_m, z_m = sort([x, y_m, z_m])
function code(y_s, x, y_m, z_m)
	tmp = 0.0
	if (Float64(z_m * z_m) <= 1e+242)
		tmp = Float64(Float64(1.0 / y_m) * Float64(Float64(1.0 / x) / fma(z_m, z_m, 1.0)));
	else
		tmp = Float64(1.0 / Float64(Float64(z_m * x) * Float64(z_m * y_m)));
	end
	return Float64(y_s * tmp)
end
z_m = N[Abs[z], $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, y_m, and z_m should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z$95$m_] := N[(y$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 1e+242], N[(N[(1.0 / y$95$m), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / N[(z$95$m * z$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(z$95$m * x), $MachinePrecision] * N[(z$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 10^{+242}:\\
\;\;\;\;\frac{1}{y\_m} \cdot \frac{\frac{1}{x}}{\mathsf{fma}\left(z\_m, z\_m, 1\right)}\\

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


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

    1. Initial program 96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000005e242 < (*.f64 z z)

    1. Initial program 80.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{y} \cdot {x}^{\color{blue}{\left(-0.5 + -0.5\right)}}}{{z}^{2}} \]
      4. pow-prod-up43.6%

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{z} \cdot \frac{{x}^{-0.5} \cdot {x}^{-0.5}}{z}} \]
      7. pow-prod-up97.6%

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

        \[\leadsto \frac{\frac{1}{y}}{z} \cdot \frac{{x}^{\color{blue}{-1}}}{z} \]
      9. inv-pow97.6%

        \[\leadsto \frac{\frac{1}{y}}{z} \cdot \frac{\color{blue}{\frac{1}{x}}}{z} \]
    9. Applied egg-rr97.6%

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{z} \cdot \frac{\frac{1}{x}}{z}} \]
    10. Step-by-step derivation
      1. clear-num97.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{\frac{1}{y}}}} \cdot \frac{\frac{1}{x}}{z} \]
      2. clear-num97.5%

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

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

        \[\leadsto \frac{\color{blue}{1}}{\frac{z}{\frac{1}{y}} \cdot \frac{z}{\frac{1}{x}}} \]
      5. div-inv97.6%

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

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

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

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

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

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

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

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

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

Alternative 5: 97.0% accurate, 0.5× speedup?

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

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


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

    1. Initial program 94.3%

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

    if 1.9999999999999999e305 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{x}}}{{z}^{2}} \]
    7. Simplified87.9%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y}}{x}}{{z}^{2}}} \]
    8. Step-by-step derivation
      1. div-inv87.9%

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

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

        \[\leadsto \frac{\frac{1}{y} \cdot {x}^{\color{blue}{\left(-0.5 + -0.5\right)}}}{{z}^{2}} \]
      4. pow-prod-up46.3%

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{z} \cdot \frac{{x}^{-0.5} \cdot {x}^{-0.5}}{z}} \]
      7. pow-prod-up90.8%

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

        \[\leadsto \frac{\frac{1}{y}}{z} \cdot \frac{{x}^{\color{blue}{-1}}}{z} \]
      9. inv-pow90.8%

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

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{z} \cdot \frac{\frac{1}{x}}{z}} \]
    10. Step-by-step derivation
      1. *-commutative90.8%

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{z} \cdot \frac{\frac{1}{y}}{z}} \]
      2. clear-num90.7%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{y}}{\frac{z}{\frac{1}{x}} \cdot z}} \]
      4. *-un-lft-identity87.9%

        \[\leadsto \frac{\color{blue}{\frac{1}{y}}}{\frac{z}{\frac{1}{x}} \cdot z} \]
      5. div-inv87.9%

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

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

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

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

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

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

Alternative 6: 95.6% accurate, 0.8× speedup?

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

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


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

    1. Initial program 95.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    7. Simplified73.5%

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

    if 1 < z

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y}}{x}}{{z}^{2}}} \]
    8. Step-by-step derivation
      1. div-inv84.5%

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

        \[\leadsto \frac{\frac{1}{y} \cdot \color{blue}{{x}^{-1}}}{{z}^{2}} \]
      3. metadata-eval84.5%

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{z} \cdot \frac{{x}^{-0.5} \cdot {x}^{-0.5}}{z}} \]
      7. pow-prod-up90.0%

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

        \[\leadsto \frac{\frac{1}{y}}{z} \cdot \frac{{x}^{\color{blue}{-1}}}{z} \]
      9. inv-pow90.0%

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

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{z} \cdot \frac{\frac{1}{x}}{z}} \]
    10. Step-by-step derivation
      1. *-commutative90.0%

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{z} \cdot \frac{\frac{1}{y}}{z}} \]
      2. clear-num90.0%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{y}}{\frac{z}{\frac{1}{x}} \cdot z}} \]
      4. *-un-lft-identity88.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{y}}}{\frac{z}{\frac{1}{x}} \cdot z} \]
      5. div-inv88.8%

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

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

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

        \[\leadsto \frac{\frac{1}{y}}{\color{blue}{\left(x \cdot z\right)} \cdot z} \]
    11. Applied egg-rr88.8%

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

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

Alternative 7: 96.6% accurate, 0.8× speedup?

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

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


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

    1. Initial program 95.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    7. Simplified73.5%

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

    if 1 < z

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y}}{x}}{{z}^{2}}} \]
    8. Step-by-step derivation
      1. div-inv84.5%

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

        \[\leadsto \frac{\frac{1}{y} \cdot \color{blue}{{x}^{-1}}}{{z}^{2}} \]
      3. metadata-eval84.5%

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{z} \cdot \frac{{x}^{-0.5} \cdot {x}^{-0.5}}{z}} \]
      7. pow-prod-up90.0%

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

        \[\leadsto \frac{\frac{1}{y}}{z} \cdot \frac{{x}^{\color{blue}{-1}}}{z} \]
      9. inv-pow90.0%

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

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{z} \cdot \frac{\frac{1}{x}}{z}} \]
    10. Step-by-step derivation
      1. clear-num90.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{\frac{1}{y}}}} \cdot \frac{\frac{1}{x}}{z} \]
      2. clear-num90.0%

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

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

        \[\leadsto \frac{\color{blue}{1}}{\frac{z}{\frac{1}{y}} \cdot \frac{z}{\frac{1}{x}}} \]
      5. div-inv89.5%

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

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

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

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

        \[\leadsto \frac{1}{\left(z \cdot y\right) \cdot \left(z \cdot \color{blue}{\frac{x}{1}}\right)} \]
      10. /-rgt-identity89.6%

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

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

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

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

Alternative 8: 71.2% accurate, 0.9× speedup?

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

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


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

    1. Initial program 95.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    7. Simplified73.5%

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

    if 1 < z

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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 9: 57.9% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
  8. Add Preprocessing

Alternative 10: 58.0% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{y \cdot \color{blue}{x}} \]
  6. Add Preprocessing

Developer target: 92.7% accurate, 0.3× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

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

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

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