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

Percentage Accurate: 90.4% → 98.8%
Time: 15.2s
Alternatives: 12
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 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.4% accurate, 1.0× speedup?

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

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

Alternative 1: 98.8% accurate, 0.1× speedup?

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

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


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

    1. Initial program 93.4%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Step-by-step derivation
      1. distribute-lft-in93.4%

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

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

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

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

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

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

    if 5e302 < (*.f64 y (+.f64 1 (*.f64 z z)))

    1. Initial program 64.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\left(x \cdot \left(y \cdot z\right)\right)} \cdot \mathsf{hypot}\left(1, z\right)} \]
    9. Step-by-step derivation
      1. expm1-log1p-u78.4%

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\left(x \cdot \left(y \cdot z\right)\right) \cdot \mathsf{hypot}\left(1, z\right)}\right)} - 1} \]
      3. *-commutative66.5%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \left(y \cdot z\right)}}\right)} - 1 \]
      5. associate-*r*63.9%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{z \cdot \left(x \cdot y\right)}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def74.3%

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

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

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

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

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

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

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

Alternative 2: 96.9% accurate, 0.1× speedup?

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

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


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

    1. Initial program 93.4%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Step-by-step derivation
      1. distribute-lft-in93.4%

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

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

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

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

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

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

    if 5e302 < (*.f64 y (+.f64 1 (*.f64 z z)))

    1. Initial program 64.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.5% accurate, 0.1× speedup?

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

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


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

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{x \cdot \mathsf{fma}\left(y, z \cdot z, y\right)}} \]
    4. Step-by-step derivation
      1. fma-udef98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999957e110 < (*.f64 z z)

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 96.9% accurate, 0.4× speedup?

\[\begin{array}{l} z = |z|\\ [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := y \cdot \left(1 + z \cdot z\right)\\ \mathbf{if}\;t_0 \leq -\infty:\\ \;\;\;\;\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+302}:\\ \;\;\;\;\frac{\frac{1}{x}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y \cdot \left(z \cdot \left(z \cdot x\right)\right)}\\ \end{array} \end{array} \]
NOTE: z should be positive before calling this function
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (+ 1.0 (* z z)))))
   (if (<= t_0 (- INFINITY))
     (/ (/ 1.0 x) (* z (* y z)))
     (if (<= t_0 5e+302) (/ (/ 1.0 x) t_0) (/ 1.0 (* y (* z (* z x))))))))
z = abs(z);
assert(x < y);
double code(double x, double y, double z) {
	double t_0 = y * (1.0 + (z * z));
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = (1.0 / x) / (z * (y * z));
	} else if (t_0 <= 5e+302) {
		tmp = (1.0 / x) / t_0;
	} else {
		tmp = 1.0 / (y * (z * (z * x)));
	}
	return tmp;
}
z = Math.abs(z);
assert x < y;
public static double code(double x, double y, double z) {
	double t_0 = y * (1.0 + (z * z));
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = (1.0 / x) / (z * (y * z));
	} else if (t_0 <= 5e+302) {
		tmp = (1.0 / x) / t_0;
	} else {
		tmp = 1.0 / (y * (z * (z * x)));
	}
	return tmp;
}
z = abs(z)
[x, y] = sort([x, y])
def code(x, y, z):
	t_0 = y * (1.0 + (z * z))
	tmp = 0
	if t_0 <= -math.inf:
		tmp = (1.0 / x) / (z * (y * z))
	elif t_0 <= 5e+302:
		tmp = (1.0 / x) / t_0
	else:
		tmp = 1.0 / (y * (z * (z * x)))
	return tmp
z = abs(z)
x, y = sort([x, y])
function code(x, y, z)
	t_0 = Float64(y * Float64(1.0 + Float64(z * z)))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(Float64(1.0 / x) / Float64(z * Float64(y * z)));
	elseif (t_0 <= 5e+302)
		tmp = Float64(Float64(1.0 / x) / t_0);
	else
		tmp = Float64(1.0 / Float64(y * Float64(z * Float64(z * x))));
	end
	return tmp
end
z = abs(z)
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	t_0 = y * (1.0 + (z * z));
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = (1.0 / x) / (z * (y * z));
	elseif (t_0 <= 5e+302)
		tmp = (1.0 / x) / t_0;
	else
		tmp = 1.0 / (y * (z * (z * x)));
	end
	tmp_2 = tmp;
end
NOTE: z should be positive before calling this function
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(1.0 / x), $MachinePrecision] / N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+302], N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(1.0 / N[(y * N[(z * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
z = |z|\\
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z \cdot z\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}\\

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+302}:\\
\;\;\;\;\frac{\frac{1}{x}}{t_0}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 y (+.f64 1 (*.f64 z z))) < -inf.0

    1. Initial program 72.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 y (+.f64 1 (*.f64 z z))) < 5e302

    1. Initial program 99.6%

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

    if 5e302 < (*.f64 y (+.f64 1 (*.f64 z z)))

    1. Initial program 64.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \leq -\infty:\\ \;\;\;\;\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}\\ \mathbf{elif}\;y \cdot \left(1 + z \cdot z\right) \leq 5 \cdot 10^{+302}:\\ \;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y \cdot \left(z \cdot \left(z \cdot x\right)\right)}\\ \end{array} \]

Alternative 5: 97.7% accurate, 0.6× speedup?

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

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


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

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{x \cdot \mathsf{fma}\left(y, z \cdot z, y\right)}} \]
    4. Step-by-step derivation
      1. fma-udef98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{1 \cdot 1 + z \cdot z} \cdot \color{blue}{\sqrt{1 \cdot 1 + z \cdot z}}} \cdot \frac{\frac{1}{x}}{y} \]
      7. add-sqr-sqrt99.0%

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

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

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

    if 9.99999999999999957e110 < (*.f64 z z)

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{+111}:\\ \;\;\;\;\frac{1}{1 + z \cdot z} \cdot \frac{\frac{1}{x}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{y \cdot z} \cdot \frac{1}{z}\\ \end{array} \]

Alternative 6: 96.5% accurate, 0.7× speedup?

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x} + -1 \cdot \frac{{z}^{2}}{x \cdot y}} \]
      3. mul-1-neg89.8%

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

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

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

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

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

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

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

    if 2.0000000000000001e-13 < (*.f64 z z)

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-13}:\\ \;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{y \cdot z} \cdot \frac{1}{z}\\ \end{array} \]

Alternative 7: 89.2% accurate, 0.8× speedup?

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{y \cdot x}} \]
    6. Simplified99.4%

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

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

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    8. Applied egg-rr99.3%

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

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

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

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

    if 2.0000000000000001e-13 < (*.f64 z z)

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 92.9% accurate, 0.8× speedup?

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{y \cdot x}} \]
    6. Simplified99.4%

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

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

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    8. Applied egg-rr99.3%

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

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

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

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

    if 2.0000000000000001e-13 < (*.f64 z z)

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 96.4% accurate, 0.8× speedup?

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{y \cdot x}} \]
    6. Simplified99.4%

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

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

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    8. Applied egg-rr99.3%

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

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

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

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

    if 2.0000000000000001e-13 < (*.f64 z z)

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 96.2% accurate, 0.8× speedup?

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x} + -1 \cdot \frac{{z}^{2}}{x \cdot y}} \]
      3. mul-1-neg89.8%

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

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

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

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

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

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

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

    if 2.0000000000000001e-13 < (*.f64 z z)

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 69.0% accurate, 1.2× speedup?

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

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


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

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{y} \]
    10. Applied egg-rr68.0%

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

    if 2e15 < z

    1. Initial program 81.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 57.8% accurate, 2.2× speedup?

\[\begin{array}{l} z = |z|\\ [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{1}{y \cdot x} \end{array} \]
NOTE: z should be positive before calling this function
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (/ 1.0 (* y x)))
z = abs(z);
assert(x < y);
double code(double x, double y, double z) {
	return 1.0 / (y * x);
}
NOTE: z should be positive before calling this function
NOTE: x and y should be sorted in increasing order before calling this function.
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 / (y * x)
end function
z = Math.abs(z);
assert x < y;
public static double code(double x, double y, double z) {
	return 1.0 / (y * x);
}
z = abs(z)
[x, y] = sort([x, y])
def code(x, y, z):
	return 1.0 / (y * x)
z = abs(z)
x, y = sort([x, y])
function code(x, y, z)
	return Float64(1.0 / Float64(y * x))
end
z = abs(z)
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = 1.0 / (y * x);
end
NOTE: z should be positive before calling this function
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z = |z|\\
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{y \cdot x}
\end{array}
Derivation
  1. Initial program 88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{y \cdot x} \]

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

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

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