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

Percentage Accurate: 90.6% → 99.1%
Time: 17.4s
Alternatives: 12
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 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.1% accurate, 0.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ [x, y, z_m] = \mathsf{sort}([x, y, z_m])\\ \\ \begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z\_m \cdot z\_m\right) \leq 4 \cdot 10^{+307}:\\ \;\;\;\;\frac{\frac{1}{x}}{\mathsf{fma}\left(z\_m \cdot y, z\_m, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(1, z\_m\right)} \cdot \frac{1}{y \cdot \left(z\_m \cdot x\right)}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x y z_m)
 :precision binary64
 (if (<= (* y (+ 1.0 (* z_m z_m))) 4e+307)
   (/ (/ 1.0 x) (fma (* z_m y) z_m y))
   (* (/ 1.0 (hypot 1.0 z_m)) (/ 1.0 (* y (* z_m x))))))
z_m = fabs(z);
assert(x < y && y < z_m);
double code(double x, double y, double z_m) {
	double tmp;
	if ((y * (1.0 + (z_m * z_m))) <= 4e+307) {
		tmp = (1.0 / x) / fma((z_m * y), z_m, y);
	} else {
		tmp = (1.0 / hypot(1.0, z_m)) * (1.0 / (y * (z_m * x)));
	}
	return tmp;
}
z_m = abs(z)
x, y, z_m = sort([x, y, z_m])
function code(x, y, z_m)
	tmp = 0.0
	if (Float64(y * Float64(1.0 + Float64(z_m * z_m))) <= 4e+307)
		tmp = Float64(Float64(1.0 / x) / fma(Float64(z_m * y), z_m, y));
	else
		tmp = Float64(Float64(1.0 / hypot(1.0, z_m)) * Float64(1.0 / Float64(y * Float64(z_m * x))));
	end
	return tmp
end
z_m = N[Abs[z], $MachinePrecision]
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
code[x_, y_, z$95$m_] := If[LessEqual[N[(y * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e+307], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(z$95$m * y), $MachinePrecision] * z$95$m + y), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(y * N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m] = \mathsf{sort}([x, y, z_m])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(1 + z\_m \cdot z\_m\right) \leq 4 \cdot 10^{+307}:\\
\;\;\;\;\frac{\frac{1}{x}}{\mathsf{fma}\left(z\_m \cdot y, z\_m, y\right)}\\

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


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

    1. Initial program 96.6%

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

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

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

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

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

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

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

    if 3.99999999999999994e307 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 78.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 73.7% accurate, 0.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ [x, y, z_m] = \mathsf{sort}([x, y, z_m])\\ \\ \frac{\frac{\frac{1}{\mathsf{hypot}\left(1, z\_m\right)}}{\sqrt{y}}}{x \cdot \left(\mathsf{hypot}\left(1, z\_m\right) \cdot \sqrt{y}\right)} \end{array} \]
z_m = (fabs.f64 z)
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x y z_m)
 :precision binary64
 (/ (/ (/ 1.0 (hypot 1.0 z_m)) (sqrt y)) (* x (* (hypot 1.0 z_m) (sqrt y)))))
z_m = fabs(z);
assert(x < y && y < z_m);
double code(double x, double y, double z_m) {
	return ((1.0 / hypot(1.0, z_m)) / sqrt(y)) / (x * (hypot(1.0, z_m) * sqrt(y)));
}
z_m = Math.abs(z);
assert x < y && y < z_m;
public static double code(double x, double y, double z_m) {
	return ((1.0 / Math.hypot(1.0, z_m)) / Math.sqrt(y)) / (x * (Math.hypot(1.0, z_m) * Math.sqrt(y)));
}
z_m = math.fabs(z)
[x, y, z_m] = sort([x, y, z_m])
def code(x, y, z_m):
	return ((1.0 / math.hypot(1.0, z_m)) / math.sqrt(y)) / (x * (math.hypot(1.0, z_m) * math.sqrt(y)))
z_m = abs(z)
x, y, z_m = sort([x, y, z_m])
function code(x, y, z_m)
	return Float64(Float64(Float64(1.0 / hypot(1.0, z_m)) / sqrt(y)) / Float64(x * Float64(hypot(1.0, z_m) * sqrt(y))))
end
z_m = abs(z);
x, y, z_m = num2cell(sort([x, y, z_m])){:}
function tmp = code(x, y, z_m)
	tmp = ((1.0 / hypot(1.0, z_m)) / sqrt(y)) / (x * (hypot(1.0, z_m) * sqrt(y)));
end
z_m = N[Abs[z], $MachinePrecision]
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
code[x_, y_, z$95$m_] := N[(N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[y], $MachinePrecision]), $MachinePrecision] / N[(x * N[(N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision] * N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m] = \mathsf{sort}([x, y, z_m])\\
\\
\frac{\frac{\frac{1}{\mathsf{hypot}\left(1, z\_m\right)}}{\sqrt{y}}}{x \cdot \left(\mathsf{hypot}\left(1, z\_m\right) \cdot \sqrt{y}\right)}
\end{array}
Derivation
  1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{y \cdot \left(x \cdot \left(\color{blue}{z \cdot z} + 1\right)\right)} \]
    11. 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. Step-by-step derivation
    1. associate-*r*93.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 73.7% accurate, 0.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{y \cdot \left(x \cdot \left(\color{blue}{z \cdot z} + 1\right)\right)} \]
    11. 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. Step-by-step derivation
    1. associate-*r*93.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 24.9% accurate, 0.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ [x, y, z_m] = \mathsf{sort}([x, y, z_m])\\ \\ \frac{1}{y \cdot {\left(\mathsf{hypot}\left(1, z\_m\right) \cdot \sqrt{x}\right)}^{2}} \end{array} \]
z_m = (fabs.f64 z)
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x y z_m)
 :precision binary64
 (/ 1.0 (* y (pow (* (hypot 1.0 z_m) (sqrt x)) 2.0))))
z_m = fabs(z);
assert(x < y && y < z_m);
double code(double x, double y, double z_m) {
	return 1.0 / (y * pow((hypot(1.0, z_m) * sqrt(x)), 2.0));
}
z_m = Math.abs(z);
assert x < y && y < z_m;
public static double code(double x, double y, double z_m) {
	return 1.0 / (y * Math.pow((Math.hypot(1.0, z_m) * Math.sqrt(x)), 2.0));
}
z_m = math.fabs(z)
[x, y, z_m] = sort([x, y, z_m])
def code(x, y, z_m):
	return 1.0 / (y * math.pow((math.hypot(1.0, z_m) * math.sqrt(x)), 2.0))
z_m = abs(z)
x, y, z_m = sort([x, y, z_m])
function code(x, y, z_m)
	return Float64(1.0 / Float64(y * (Float64(hypot(1.0, z_m) * sqrt(x)) ^ 2.0)))
end
z_m = abs(z);
x, y, z_m = num2cell(sort([x, y, z_m])){:}
function tmp = code(x, y, z_m)
	tmp = 1.0 / (y * ((hypot(1.0, z_m) * sqrt(x)) ^ 2.0));
end
z_m = N[Abs[z], $MachinePrecision]
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
code[x_, y_, z$95$m_] := N[(1.0 / N[(y * N[Power[N[(N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m] = \mathsf{sort}([x, y, z_m])\\
\\
\frac{1}{y \cdot {\left(\mathsf{hypot}\left(1, z\_m\right) \cdot \sqrt{x}\right)}^{2}}
\end{array}
Derivation
  1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{y \cdot \left(x \cdot \left(\color{blue}{z \cdot z} + 1\right)\right)} \]
    11. 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. Step-by-step derivation
    1. add-sqr-sqrt47.6%

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

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

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

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

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

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

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

    \[\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.4% accurate, 0.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ [x, y, z_m] = \mathsf{sort}([x, y, z_m])\\ \\ \frac{1}{\mathsf{hypot}\left(1, z\_m\right)} \cdot \frac{1}{y \cdot \left(\mathsf{hypot}\left(1, z\_m\right) \cdot x\right)} \end{array} \]
z_m = (fabs.f64 z)
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x y z_m)
 :precision binary64
 (* (/ 1.0 (hypot 1.0 z_m)) (/ 1.0 (* y (* (hypot 1.0 z_m) x)))))
z_m = fabs(z);
assert(x < y && y < z_m);
double code(double x, double y, double z_m) {
	return (1.0 / hypot(1.0, z_m)) * (1.0 / (y * (hypot(1.0, z_m) * x)));
}
z_m = Math.abs(z);
assert x < y && y < z_m;
public static double code(double x, double y, double z_m) {
	return (1.0 / Math.hypot(1.0, z_m)) * (1.0 / (y * (Math.hypot(1.0, z_m) * x)));
}
z_m = math.fabs(z)
[x, y, z_m] = sort([x, y, z_m])
def code(x, y, z_m):
	return (1.0 / math.hypot(1.0, z_m)) * (1.0 / (y * (math.hypot(1.0, z_m) * x)))
z_m = abs(z)
x, y, z_m = sort([x, y, z_m])
function code(x, y, z_m)
	return Float64(Float64(1.0 / hypot(1.0, z_m)) * Float64(1.0 / Float64(y * Float64(hypot(1.0, z_m) * x))))
end
z_m = abs(z);
x, y, z_m = num2cell(sort([x, y, z_m])){:}
function tmp = code(x, y, z_m)
	tmp = (1.0 / hypot(1.0, z_m)) * (1.0 / (y * (hypot(1.0, z_m) * x)));
end
z_m = N[Abs[z], $MachinePrecision]
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
code[x_, y_, z$95$m_] := N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(y * N[(N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m] = \mathsf{sort}([x, y, z_m])\\
\\
\frac{1}{\mathsf{hypot}\left(1, z\_m\right)} \cdot \frac{1}{y \cdot \left(\mathsf{hypot}\left(1, z\_m\right) \cdot x\right)}
\end{array}
Derivation
  1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{y \cdot \left(x \cdot \left(\color{blue}{z \cdot z} + 1\right)\right)} \]
    11. 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. Step-by-step derivation
    1. associate-*r*93.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 97.0% accurate, 0.1× speedup?

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

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


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

    1. Initial program 97.7%

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

        \[\leadsto \color{blue}{\frac{1}{\left(y \cdot \left(1 + z \cdot z\right)\right) \cdot x}} \]
      2. remove-double-neg96.9%

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e241 < (*.f64 z z)

    1. Initial program 82.8%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Step-by-step derivation
      1. remove-double-neg82.8%

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{-\left(-y \cdot \left(1 + z \cdot z\right)\right)}} \]
      2. distribute-lft-neg-out82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{z}}{y} \cdot \frac{\frac{1}{{z}^{\color{blue}{1}}}}{x} \]
      14. pow198.5%

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

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

Alternative 7: 93.8% accurate, 0.5× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ [x, y, z_m] = \mathsf{sort}([x, y, z_m])\\ \\ \begin{array}{l} \mathbf{if}\;z\_m \cdot z\_m \leq 10^{-9}:\\ \;\;\;\;\frac{\frac{1}{x}}{y}\\ \mathbf{elif}\;z\_m \cdot z\_m \leq 10^{+243}:\\ \;\;\;\;\frac{1}{y \cdot \left(x \cdot \left(z\_m \cdot z\_m\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{y \cdot x}}{z\_m}}{z\_m}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x y z_m)
 :precision binary64
 (if (<= (* z_m z_m) 1e-9)
   (/ (/ 1.0 x) y)
   (if (<= (* z_m z_m) 1e+243)
     (/ 1.0 (* y (* x (* z_m z_m))))
     (/ (/ (/ 1.0 (* y x)) z_m) z_m))))
z_m = fabs(z);
assert(x < y && y < z_m);
double code(double x, double y, double z_m) {
	double tmp;
	if ((z_m * z_m) <= 1e-9) {
		tmp = (1.0 / x) / y;
	} else if ((z_m * z_m) <= 1e+243) {
		tmp = 1.0 / (y * (x * (z_m * z_m)));
	} else {
		tmp = ((1.0 / (y * x)) / z_m) / z_m;
	}
	return tmp;
}
z_m = abs(z)
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if ((z_m * z_m) <= 1d-9) then
        tmp = (1.0d0 / x) / y
    else if ((z_m * z_m) <= 1d+243) then
        tmp = 1.0d0 / (y * (x * (z_m * z_m)))
    else
        tmp = ((1.0d0 / (y * x)) / z_m) / z_m
    end if
    code = tmp
end function
z_m = Math.abs(z);
assert x < y && y < z_m;
public static double code(double x, double y, double z_m) {
	double tmp;
	if ((z_m * z_m) <= 1e-9) {
		tmp = (1.0 / x) / y;
	} else if ((z_m * z_m) <= 1e+243) {
		tmp = 1.0 / (y * (x * (z_m * z_m)));
	} else {
		tmp = ((1.0 / (y * x)) / z_m) / z_m;
	}
	return tmp;
}
z_m = math.fabs(z)
[x, y, z_m] = sort([x, y, z_m])
def code(x, y, z_m):
	tmp = 0
	if (z_m * z_m) <= 1e-9:
		tmp = (1.0 / x) / y
	elif (z_m * z_m) <= 1e+243:
		tmp = 1.0 / (y * (x * (z_m * z_m)))
	else:
		tmp = ((1.0 / (y * x)) / z_m) / z_m
	return tmp
z_m = abs(z)
x, y, z_m = sort([x, y, z_m])
function code(x, y, z_m)
	tmp = 0.0
	if (Float64(z_m * z_m) <= 1e-9)
		tmp = Float64(Float64(1.0 / x) / y);
	elseif (Float64(z_m * z_m) <= 1e+243)
		tmp = Float64(1.0 / Float64(y * Float64(x * Float64(z_m * z_m))));
	else
		tmp = Float64(Float64(Float64(1.0 / Float64(y * x)) / z_m) / z_m);
	end
	return tmp
end
z_m = abs(z);
x, y, z_m = num2cell(sort([x, y, z_m])){:}
function tmp_2 = code(x, y, z_m)
	tmp = 0.0;
	if ((z_m * z_m) <= 1e-9)
		tmp = (1.0 / x) / y;
	elseif ((z_m * z_m) <= 1e+243)
		tmp = 1.0 / (y * (x * (z_m * z_m)));
	else
		tmp = ((1.0 / (y * x)) / z_m) / z_m;
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
code[x_, y_, z$95$m_] := If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 1e-9], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 1e+243], N[(1.0 / N[(y * N[(x * N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision] / z$95$m), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m] = \mathsf{sort}([x, y, z_m])\\
\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 10^{-9}:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\

\mathbf{elif}\;z\_m \cdot z\_m \leq 10^{+243}:\\
\;\;\;\;\frac{1}{y \cdot \left(x \cdot \left(z\_m \cdot z\_m\right)\right)}\\

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


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

    1. Initial program 99.7%

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

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

    if 1.00000000000000006e-9 < (*.f64 z z) < 1.0000000000000001e243

    1. Initial program 92.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.0000000000000001e243 < (*.f64 z z)

    1. Initial program 82.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\frac{{x}^{\color{blue}{-1}}}{y}}{z}}{z} \]
      11. inv-pow93.9%

        \[\leadsto \frac{\frac{\frac{\color{blue}{\frac{1}{x}}}{y}}{z}}{z} \]
      12. associate-/l/93.9%

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

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

Alternative 8: 97.7% accurate, 0.6× speedup?

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

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


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

    1. Initial program 99.7%

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

    if 2e7 < (*.f64 z z)

    1. Initial program 86.7%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Step-by-step derivation
      1. remove-double-neg86.7%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\left(-\left(-\left(1 + z \cdot z\right)\right)\right) \cdot \left(y \cdot x\right)}} \]
      10. remove-double-neg86.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 97.0% accurate, 0.6× speedup?

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

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


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

    1. Initial program 99.7%

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

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

    if 1.00000000000000006e-9 < (*.f64 z z)

    1. Initial program 86.9%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Step-by-step derivation
      1. remove-double-neg86.9%

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{-\left(-y \cdot \left(1 + z \cdot z\right)\right)}} \]
      2. distribute-lft-neg-out86.9%

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\left(-\left(1 + z \cdot z\right)\right) \cdot \left(\left(-y\right) \cdot x\right)}} \]
      7. distribute-lft-neg-out86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 89.9% accurate, 0.7× speedup?

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

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


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

    1. Initial program 99.7%

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

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

    if 1 < (*.f64 z z)

    1. Initial program 86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 58.6% accurate, 2.2× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ [x, y, z_m] = \mathsf{sort}([x, y, z_m])\\ \\ \frac{\frac{1}{x}}{y} \end{array} \]
z_m = (fabs.f64 z)
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x y z_m) :precision binary64 (/ (/ 1.0 x) y))
z_m = fabs(z);
assert(x < y && y < z_m);
double code(double x, double y, double z_m) {
	return (1.0 / x) / y;
}
z_m = abs(z)
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    code = (1.0d0 / x) / y
end function
z_m = Math.abs(z);
assert x < y && y < z_m;
public static double code(double x, double y, double z_m) {
	return (1.0 / x) / y;
}
z_m = math.fabs(z)
[x, y, z_m] = sort([x, y, z_m])
def code(x, y, z_m):
	return (1.0 / x) / y
z_m = abs(z)
x, y, z_m = sort([x, y, z_m])
function code(x, y, z_m)
	return Float64(Float64(1.0 / x) / y)
end
z_m = abs(z);
x, y, z_m = num2cell(sort([x, y, z_m])){:}
function tmp = code(x, y, z_m)
	tmp = (1.0 / x) / y;
end
z_m = N[Abs[z], $MachinePrecision]
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
code[x_, y_, z$95$m_] := N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m] = \mathsf{sort}([x, y, z_m])\\
\\
\frac{\frac{1}{x}}{y}
\end{array}
Derivation
  1. Initial program 93.9%

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

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

Alternative 12: 58.6% accurate, 2.2× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ [x, y, z_m] = \mathsf{sort}([x, y, z_m])\\ \\ \frac{1}{y \cdot x} \end{array} \]
z_m = (fabs.f64 z)
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x y z_m) :precision binary64 (/ 1.0 (* y x)))
z_m = fabs(z);
assert(x < y && y < z_m);
double code(double x, double y, double z_m) {
	return 1.0 / (y * x);
}
z_m = abs(z)
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x, y, z_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    code = 1.0d0 / (y * x)
end function
z_m = Math.abs(z);
assert x < y && y < z_m;
public static double code(double x, double y, double z_m) {
	return 1.0 / (y * x);
}
z_m = math.fabs(z)
[x, y, z_m] = sort([x, y, z_m])
def code(x, y, z_m):
	return 1.0 / (y * x)
z_m = abs(z)
x, y, z_m = sort([x, y, z_m])
function code(x, y, z_m)
	return Float64(1.0 / Float64(y * x))
end
z_m = abs(z);
x, y, z_m = num2cell(sort([x, y, z_m])){:}
function tmp = code(x, y, z_m)
	tmp = 1.0 / (y * x);
end
z_m = N[Abs[z], $MachinePrecision]
NOTE: x, y, and z_m should be sorted in increasing order before calling this function.
code[x_, y_, z$95$m_] := N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m] = \mathsf{sort}([x, y, z_m])\\
\\
\frac{1}{y \cdot x}
\end{array}
Derivation
  1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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