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

Percentage Accurate: 89.8% → 98.9%
Time: 10.9s
Alternatives: 6
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 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: 98.9% accurate, 0.5× speedup?

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

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


\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))) < 2.00000000000000003e306

    1. Initial program 94.9%

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

    if 2.00000000000000003e306 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x \cdot y}}{{z}^{2}}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity79.5%

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

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

        \[\leadsto 1 \cdot \color{blue}{\frac{\frac{1}{{z}^{2}}}{x \cdot y}} \]
      4. pow-flip80.0%

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

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

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

        \[\leadsto \color{blue}{\frac{{z}^{-2}}{x \cdot y}} \]
    11. Simplified80.0%

      \[\leadsto \color{blue}{\frac{{z}^{-2}}{x \cdot y}} \]
    12. Step-by-step derivation
      1. sqr-pow80.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{\frac{1}{z}}{x}}{y}}}{z} \]
    15. Applied egg-rr99.9%

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

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

Alternative 2: 49.3% accurate, 0.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. +-commutative46.7%

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

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

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

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

      \[\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. +-commutative46.7%

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

      \[\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. +-commutative46.7%

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

    \[\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/51.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 76.8% accurate, 0.8× speedup?

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

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


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

    1. Initial program 93.7%

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

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

    if 1 < z

    1. Initial program 83.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 78.4% accurate, 0.8× speedup?

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

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


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

    1. Initial program 93.7%

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

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

    if 1 < z

    1. Initial program 83.1%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x \cdot y}}{{z}^{2}}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity83.9%

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

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

        \[\leadsto 1 \cdot \color{blue}{\frac{\frac{1}{{z}^{2}}}{x \cdot y}} \]
      4. pow-flip84.0%

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

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

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

        \[\leadsto \color{blue}{\frac{{z}^{-2}}{x \cdot y}} \]
    11. Simplified84.0%

      \[\leadsto \color{blue}{\frac{{z}^{-2}}{x \cdot y}} \]
    12. Step-by-step derivation
      1. sqr-pow83.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 78.3% accurate, 0.8× speedup?

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

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


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

    1. Initial program 93.7%

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

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

    if 1 < z

    1. Initial program 83.1%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x \cdot y}}{{z}^{2}}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity83.9%

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

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

        \[\leadsto 1 \cdot \color{blue}{\frac{\frac{1}{{z}^{2}}}{x \cdot y}} \]
      4. pow-flip84.0%

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

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

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

        \[\leadsto \color{blue}{\frac{{z}^{-2}}{x \cdot y}} \]
    11. Simplified84.0%

      \[\leadsto \color{blue}{\frac{{z}^{-2}}{x \cdot y}} \]
    12. Step-by-step derivation
      1. sqr-pow83.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 58.7% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

Developer target: 92.7% accurate, 0.3× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024079 
(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)))))