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

Percentage Accurate: 88.7% → 98.6%
Time: 13.2s
Alternatives: 10
Speedup: 0.6×

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: 88.7% accurate, 1.0× speedup?

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

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

Alternative 1: 98.6% accurate, 0.1× speedup?

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{y}}{x \cdot \mathsf{fma}\left(z, z, 1\right)}} + 0 \]
      8. *-un-lft-identity99.5%

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

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

    if 1e27 < (*.f64 z z)

    1. Initial program 77.4%

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

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

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

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      5. metadata-eval79.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.6% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1 \cdot \frac{1}{x}}{\color{blue}{1 + z \cdot z}}}{y} \]
    5. add-sqr-sqrt89.5%

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

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

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

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

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

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

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

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

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

Alternative 3: 98.8% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.5% accurate, 0.1× speedup?

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\frac{-1}{x}}{y}}{0 - \color{blue}{\left(1 + {z}^{2}\right)}} \]
      8. associate--r+99.7%

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

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

      \[\leadsto \color{blue}{\frac{\frac{\frac{-1}{x}}{y}}{-1 - {z}^{2}}} \]

    if 1e27 < (*.f64 z z)

    1. Initial program 77.4%

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

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

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

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

        \[\leadsto \frac{\frac{\frac{-1}{\color{blue}{-x}}}{1 + z \cdot z}}{y} \]
      5. metadata-eval79.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 98.5% accurate, 0.6× speedup?

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

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


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

    1. Initial program 99.7%

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

    if 5.00000000000000045e24 < (*.f64 z z)

    1. Initial program 77.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 79.0% accurate, 0.7× speedup?

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

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


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

    1. Initial program 93.1%

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    5. Simplified68.3%

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

    if 1 < z

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 76.9% accurate, 0.8× speedup?

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

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


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

    1. Initial program 93.1%

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    5. Simplified68.3%

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

    if 1 < z

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\left(\left(x \cdot y\right) \cdot z\right) \cdot z}} \]
    7. Applied egg-rr87.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 simplification72.7%

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

Alternative 8: 66.0% accurate, 0.9× speedup?

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

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


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

    1. Initial program 93.1%

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    5. Simplified68.3%

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

    if 1 < z

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1 \cdot \frac{1}{x}}{\color{blue}{1 + z \cdot z}}}{y} \]
      5. add-sqr-sqrt75.6%

        \[\leadsto \frac{\frac{1 \cdot \frac{1}{x}}{\color{blue}{\sqrt{1 + z \cdot z} \cdot \sqrt{1 + z \cdot z}}}}{y} \]
      6. times-frac75.5%

        \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{1 + z \cdot z}} \cdot \frac{\frac{1}{x}}{\sqrt{1 + z \cdot z}}}}{y} \]
      7. hypot-1-def75.5%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{x \cdot y}} \]
  4. Final simplification57.3%

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

Alternative 10: 58.5% accurate, 2.2× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
  5. Simplified57.2%

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

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

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

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

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