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

Percentage Accurate: 90.6% → 99.2%
Time: 12.6s
Alternatives: 12
Speedup: 0.7×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 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: 90.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.2% accurate, 0.0× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ \begin{array}{l} t_0 := z \cdot \sqrt{y\_m}\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{+59}:\\ \;\;\;\;\frac{1}{y\_m \cdot \left(x \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t\_0} \cdot \frac{\frac{1}{x}}{t\_0}\\ \end{array} \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (let* ((t_0 (* z (sqrt y_m))))
   (*
    y_s
    (if (<= (* z z) 1e+59)
      (/ 1.0 (* y_m (* x (fma z z 1.0))))
      (* (/ 1.0 t_0) (/ (/ 1.0 x) t_0))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double t_0 = z * sqrt(y_m);
	double tmp;
	if ((z * z) <= 1e+59) {
		tmp = 1.0 / (y_m * (x * fma(z, z, 1.0)));
	} else {
		tmp = (1.0 / t_0) * ((1.0 / x) / t_0);
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	t_0 = Float64(z * sqrt(y_m))
	tmp = 0.0
	if (Float64(z * z) <= 1e+59)
		tmp = Float64(1.0 / Float64(y_m * Float64(x * fma(z, z, 1.0))));
	else
		tmp = Float64(Float64(1.0 / t_0) * Float64(Float64(1.0 / x) / t_0));
	end
	return Float64(y_s * tmp)
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(z * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 1e+59], N[(1.0 / N[(y$95$m * N[(x * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
\begin{array}{l}
t_0 := z \cdot \sqrt{y\_m}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+59}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_0} \cdot \frac{\frac{1}{x}}{t\_0}\\


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

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

    if 9.99999999999999972e58 < (*.f64 z z)

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y} \cdot z} \cdot \frac{\frac{1}{x}}{\sqrt{y} \cdot z}} \]
      6. *-commutative47.0%

        \[\leadsto \frac{1}{\color{blue}{z \cdot \sqrt{y}}} \cdot \frac{\frac{1}{x}}{\sqrt{y} \cdot z} \]
      7. *-commutative47.0%

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

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

Alternative 2: 49.5% accurate, 0.0× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot {\left(\frac{{x}^{-0.5}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y\_m}}\right)}^{2} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (* y_s (pow (/ (pow x -0.5) (* (hypot 1.0 z) (sqrt y_m))) 2.0)))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	return y_s * pow((pow(x, -0.5) / (hypot(1.0, z) * sqrt(y_m))), 2.0);
}
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	return y_s * Math.pow((Math.pow(x, -0.5) / (Math.hypot(1.0, z) * Math.sqrt(y_m))), 2.0);
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	return y_s * math.pow((math.pow(x, -0.5) / (math.hypot(1.0, z) * math.sqrt(y_m))), 2.0)
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	return Float64(y_s * (Float64((x ^ -0.5) / Float64(hypot(1.0, z) * sqrt(y_m))) ^ 2.0))
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp = code(y_s, x, y_m, z)
	tmp = y_s * (((x ^ -0.5) / (hypot(1.0, z) * sqrt(y_m))) ^ 2.0);
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[Power[N[(N[Power[x, -0.5], $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot {\left(\frac{{x}^{-0.5}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y\_m}}\right)}^{2}
\end{array}
Derivation
  1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 49.5% accurate, 0.0× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot {\left(\frac{\frac{{x}^{-0.5}}{\sqrt{y\_m}}}{\mathsf{hypot}\left(1, z\right)}\right)}^{2} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (* y_s (pow (/ (/ (pow x -0.5) (sqrt y_m)) (hypot 1.0 z)) 2.0)))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	return y_s * pow(((pow(x, -0.5) / sqrt(y_m)) / hypot(1.0, z)), 2.0);
}
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	return y_s * Math.pow(((Math.pow(x, -0.5) / Math.sqrt(y_m)) / Math.hypot(1.0, z)), 2.0);
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	return y_s * math.pow(((math.pow(x, -0.5) / math.sqrt(y_m)) / math.hypot(1.0, z)), 2.0)
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	return Float64(y_s * (Float64(Float64((x ^ -0.5) / sqrt(y_m)) / hypot(1.0, z)) ^ 2.0))
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp = code(y_s, x, y_m, z)
	tmp = y_s * ((((x ^ -0.5) / sqrt(y_m)) / hypot(1.0, z)) ^ 2.0);
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[Power[N[(N[(N[Power[x, -0.5], $MachinePrecision] / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot {\left(\frac{\frac{{x}^{-0.5}}{\sqrt{y\_m}}}{\mathsf{hypot}\left(1, z\right)}\right)}^{2}
\end{array}
Derivation
  1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 46.8% accurate, 0.0× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \frac{1}{y\_m \cdot {\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x}\right)}^{2}} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (* y_s (/ 1.0 (* y_m (pow (* (hypot 1.0 z) (sqrt x)) 2.0)))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	return y_s * (1.0 / (y_m * pow((hypot(1.0, z) * sqrt(x)), 2.0)));
}
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	return y_s * (1.0 / (y_m * Math.pow((Math.hypot(1.0, z) * Math.sqrt(x)), 2.0)));
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	return y_s * (1.0 / (y_m * math.pow((math.hypot(1.0, z) * math.sqrt(x)), 2.0)))
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	return Float64(y_s * Float64(1.0 / Float64(y_m * (Float64(hypot(1.0, z) * sqrt(x)) ^ 2.0))))
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp = code(y_s, x, y_m, z)
	tmp = y_s * (1.0 / (y_m * ((hypot(1.0, z) * sqrt(x)) ^ 2.0)));
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(1.0 / N[(y$95$m * N[Power[N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \frac{1}{y\_m \cdot {\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x}\right)}^{2}}
\end{array}
Derivation
  1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 97.0% accurate, 0.1× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+285}:\\ \;\;\;\;\frac{1}{y\_m \cdot \left(x \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{z} \cdot \frac{\frac{1}{y\_m}}{z}\\ \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= (* z z) 2e+285)
    (/ 1.0 (* y_m (* x (fma z z 1.0))))
    (* (/ (/ 1.0 x) z) (/ (/ 1.0 y_m) z)))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((z * z) <= 2e+285) {
		tmp = 1.0 / (y_m * (x * fma(z, z, 1.0)));
	} else {
		tmp = ((1.0 / x) / z) * ((1.0 / y_m) / z);
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (Float64(z * z) <= 2e+285)
		tmp = Float64(1.0 / Float64(y_m * Float64(x * fma(z, z, 1.0))));
	else
		tmp = Float64(Float64(Float64(1.0 / x) / z) * Float64(Float64(1.0 / y_m) / z));
	end
	return Float64(y_s * tmp)
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e+285], N[(1.0 / N[(y$95$m * N[(x * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision] * N[(N[(1.0 / y$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+285}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\

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


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

    1. Initial program 96.7%

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

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

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

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

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

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

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

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

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

    if 2e285 < (*.f64 z z)

    1. Initial program 76.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 97.7% accurate, 0.6× speedup?

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

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+74}:\\
\;\;\;\;\frac{\frac{1}{x}}{y\_m \cdot \left(1 + z \cdot z\right)}\\

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


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

    1. Initial program 99.0%

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

    if 4.99999999999999963e74 < (*.f64 z z)

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 96.5% accurate, 0.6× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-14}:\\ \;\;\;\;\frac{\frac{1}{y\_m}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{z} \cdot \frac{\frac{1}{y\_m}}{z}\\ \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= (* z z) 2e-14)
    (/ (/ 1.0 y_m) x)
    (* (/ (/ 1.0 x) z) (/ (/ 1.0 y_m) z)))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((z * z) <= 2e-14) {
		tmp = (1.0 / y_m) / x;
	} else {
		tmp = ((1.0 / x) / z) * ((1.0 / y_m) / z);
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z * z) <= 2d-14) then
        tmp = (1.0d0 / y_m) / x
    else
        tmp = ((1.0d0 / x) / z) * ((1.0d0 / y_m) / z)
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((z * z) <= 2e-14) {
		tmp = (1.0 / y_m) / x;
	} else {
		tmp = ((1.0 / x) / z) * ((1.0 / y_m) / z);
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if (z * z) <= 2e-14:
		tmp = (1.0 / y_m) / x
	else:
		tmp = ((1.0 / x) / z) * ((1.0 / y_m) / z)
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (Float64(z * z) <= 2e-14)
		tmp = Float64(Float64(1.0 / y_m) / x);
	else
		tmp = Float64(Float64(Float64(1.0 / x) / z) * Float64(Float64(1.0 / y_m) / z));
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if ((z * z) <= 2e-14)
		tmp = (1.0 / y_m) / x;
	else
		tmp = ((1.0 / x) / z) * ((1.0 / y_m) / z);
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e-14], N[(N[(1.0 / y$95$m), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision] * N[(N[(1.0 / y$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x}\\

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


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

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
      2. div-inv98.6%

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    8. Step-by-step derivation
      1. un-div-inv99.6%

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

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

    if 2e-14 < (*.f64 z z)

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 96.2% accurate, 0.6× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-14}:\\ \;\;\;\;\frac{\frac{1}{y\_m}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{1}{x \cdot \left(z \cdot y\_m\right)}\\ \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= (* z z) 2e-14)
    (/ (/ 1.0 y_m) x)
    (* (/ 1.0 z) (/ 1.0 (* x (* z y_m)))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((z * z) <= 2e-14) {
		tmp = (1.0 / y_m) / x;
	} else {
		tmp = (1.0 / z) * (1.0 / (x * (z * y_m)));
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z * z) <= 2d-14) then
        tmp = (1.0d0 / y_m) / x
    else
        tmp = (1.0d0 / z) * (1.0d0 / (x * (z * y_m)))
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((z * z) <= 2e-14) {
		tmp = (1.0 / y_m) / x;
	} else {
		tmp = (1.0 / z) * (1.0 / (x * (z * y_m)));
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if (z * z) <= 2e-14:
		tmp = (1.0 / y_m) / x
	else:
		tmp = (1.0 / z) * (1.0 / (x * (z * y_m)))
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (Float64(z * z) <= 2e-14)
		tmp = Float64(Float64(1.0 / y_m) / x);
	else
		tmp = Float64(Float64(1.0 / z) * Float64(1.0 / Float64(x * Float64(z * y_m))));
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if ((z * z) <= 2e-14)
		tmp = (1.0 / y_m) / x;
	else
		tmp = (1.0 / z) * (1.0 / (x * (z * y_m)));
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e-14], N[(N[(1.0 / y$95$m), $MachinePrecision] / x), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(1.0 / N[(x * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x}\\

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


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

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
      2. div-inv98.6%

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    8. Step-by-step derivation
      1. un-div-inv99.6%

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

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

    if 2e-14 < (*.f64 z z)

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{z} \cdot \frac{\frac{1}{x \cdot y}}{z}} \]
    10. Taylor expanded in x around 0 95.9%

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

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

Alternative 9: 94.2% accurate, 0.7× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-14}:\\ \;\;\;\;\frac{\frac{1}{y\_m}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z \cdot \left(x \cdot y\_m\right)}}{z}\\ \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= (* z z) 2e-14) (/ (/ 1.0 y_m) x) (/ (/ 1.0 (* z (* x y_m))) z))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((z * z) <= 2e-14) {
		tmp = (1.0 / y_m) / x;
	} else {
		tmp = (1.0 / (z * (x * y_m))) / z;
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z * z) <= 2d-14) then
        tmp = (1.0d0 / y_m) / x
    else
        tmp = (1.0d0 / (z * (x * y_m))) / z
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((z * z) <= 2e-14) {
		tmp = (1.0 / y_m) / x;
	} else {
		tmp = (1.0 / (z * (x * y_m))) / z;
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if (z * z) <= 2e-14:
		tmp = (1.0 / y_m) / x
	else:
		tmp = (1.0 / (z * (x * y_m))) / z
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (Float64(z * z) <= 2e-14)
		tmp = Float64(Float64(1.0 / y_m) / x);
	else
		tmp = Float64(Float64(1.0 / Float64(z * Float64(x * y_m))) / z);
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if ((z * z) <= 2e-14)
		tmp = (1.0 / y_m) / x;
	else
		tmp = (1.0 / (z * (x * y_m))) / z;
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e-14], N[(N[(1.0 / y$95$m), $MachinePrecision] / x), $MachinePrecision], N[(N[(1.0 / N[(z * N[(x * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x}\\

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


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

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
      2. div-inv98.6%

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    8. Step-by-step derivation
      1. un-div-inv99.6%

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

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

    if 2e-14 < (*.f64 z z)

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 76.9% accurate, 0.8× speedup?

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

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 0.0033:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x}\\

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


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

    1. Initial program 94.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
      2. div-inv71.6%

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    8. Step-by-step derivation
      1. un-div-inv72.2%

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    9. Applied egg-rr72.2%

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

    if 0.0033 < z

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{x}}{y}}{{z}^{2}}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(x \cdot y\right)}^{-0.5} \cdot {\left(x \cdot y\right)}^{-0.5}}{z \cdot z}} \]
      3. pow-prod-up83.8%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 0.0033:\\ \;\;\;\;\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 11: 59.2% accurate, 2.2× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \frac{\frac{1}{y\_m}}{x} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z) :precision binary64 (* y_s (/ (/ 1.0 y_m) x)))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	return y_s * ((1.0 / y_m) / x);
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    code = y_s * ((1.0d0 / y_m) / x)
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	return y_s * ((1.0 / y_m) / x);
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	return y_s * ((1.0 / y_m) / x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	return Float64(y_s * Float64(Float64(1.0 / y_m) / x))
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp = code(y_s, x, y_m, z)
	tmp = y_s * ((1.0 / y_m) / x);
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(N[(1.0 / y$95$m), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \frac{\frac{1}{y\_m}}{x}
\end{array}
Derivation
  1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    2. div-inv57.1%

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

    \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
  8. Step-by-step derivation
    1. un-div-inv57.5%

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
  9. Applied egg-rr57.5%

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

Alternative 12: 59.2% accurate, 2.2× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \frac{1}{x \cdot y\_m} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z) :precision binary64 (* y_s (/ 1.0 (* x y_m))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	return y_s * (1.0 / (x * y_m));
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    code = y_s * (1.0d0 / (x * y_m))
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	return y_s * (1.0 / (x * y_m));
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	return y_s * (1.0 / (x * y_m))
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	return Float64(y_s * Float64(1.0 / Float64(x * y_m)))
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp = code(y_s, x, y_m, z)
	tmp = y_s * (1.0 / (x * y_m));
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(1.0 / N[(x * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \frac{1}{x \cdot y\_m}
\end{array}
Derivation
  1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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