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

Percentage Accurate: 90.8% → 99.0%
Time: 18.3s
Alternatives: 13
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 13 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.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.0% accurate, 0.0× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{t_0} \cdot \frac{1}{x \cdot t_0}\\


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

    1. Initial program 93.3%

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

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

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

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

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

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

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

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

    1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{z \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\color{blue}{\sqrt{z \cdot z} \cdot \sqrt{y}}} \]
      12. sqrt-prod49.9%

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

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

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

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

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

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

Alternative 2: 97.9% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \leq 4 \cdot 10^{+302}:\\ \;\;\;\;\frac{\frac{1}{x}}{\mathsf{fma}\left(y \cdot z, z, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{x}}{y \cdot z}\\ \end{array} \end{array} \]
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))) 4e+302)
   (/ (/ 1.0 x) (fma (* y z) z y))
   (* (/ 1.0 z) (/ (/ 1.0 x) (* y z)))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((y * (1.0 + (z * z))) <= 4e+302) {
		tmp = (1.0 / x) / fma((y * z), z, y);
	} else {
		tmp = (1.0 / z) * ((1.0 / x) / (y * z));
	}
	return tmp;
}
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (Float64(y * Float64(1.0 + Float64(z * z))) <= 4e+302)
		tmp = Float64(Float64(1.0 / x) / fma(Float64(y * z), z, y));
	else
		tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / x) / Float64(y * z)));
	end
	return tmp
end
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], 4e+302], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \leq 4 \cdot 10^{+302}:\\
\;\;\;\;\frac{\frac{1}{x}}{\mathsf{fma}\left(y \cdot z, z, y\right)}\\

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


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

    1. Initial program 93.3%

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

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

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

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

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

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

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

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

    1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.0% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{-5}:\\ \;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y \cdot z} \cdot \frac{\frac{1}{x}}{z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= (* z z) 1e-5)
   (/ (- 1.0 (* z z)) (* y x))
   (* (/ 1.0 (* y z)) (/ (/ 1.0 x) z))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1e-5) {
		tmp = (1.0 - (z * z)) / (y * x);
	} else {
		tmp = (1.0 / (y * z)) * ((1.0 / x) / z);
	}
	return tmp;
}
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-5) then
        tmp = (1.0d0 - (z * z)) / (y * x)
    else
        tmp = (1.0d0 / (y * z)) * ((1.0d0 / x) / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1e-5) {
		tmp = (1.0 - (z * z)) / (y * x);
	} else {
		tmp = (1.0 / (y * z)) * ((1.0 / x) / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z * z) <= 1e-5:
		tmp = (1.0 - (z * z)) / (y * x)
	else:
		tmp = (1.0 / (y * z)) * ((1.0 / x) / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (Float64(z * z) <= 1e-5)
		tmp = Float64(Float64(1.0 - Float64(z * z)) / Float64(y * x));
	else
		tmp = Float64(Float64(1.0 / Float64(y * z)) * Float64(Float64(1.0 / x) / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z * z) <= 1e-5)
		tmp = (1.0 - (z * z)) / (y * x);
	else
		tmp = (1.0 / (y * z)) * ((1.0 / x) / z);
	end
	tmp_2 = tmp;
end
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-5], N[(N[(1.0 - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\

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


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

    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.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000008e-5 < (*.f64 z z)

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.5% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+51}:\\ \;\;\;\;\frac{1}{x \cdot \left(y + y \cdot \left(z \cdot z\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z \cdot x}}{y \cdot z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= (* z z) 2e+51)
   (/ 1.0 (* x (+ y (* y (* z z)))))
   (/ (/ 1.0 (* z x)) (* y z))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 2e+51) {
		tmp = 1.0 / (x * (y + (y * (z * z))));
	} else {
		tmp = (1.0 / (z * x)) / (y * z);
	}
	return tmp;
}
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+51) then
        tmp = 1.0d0 / (x * (y + (y * (z * z))))
    else
        tmp = (1.0d0 / (z * x)) / (y * z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 2e+51) {
		tmp = 1.0 / (x * (y + (y * (z * z))));
	} else {
		tmp = (1.0 / (z * x)) / (y * z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z * z) <= 2e+51:
		tmp = 1.0 / (x * (y + (y * (z * z))))
	else:
		tmp = (1.0 / (z * x)) / (y * z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (Float64(z * z) <= 2e+51)
		tmp = Float64(1.0 / Float64(x * Float64(y + Float64(y * Float64(z * z)))));
	else
		tmp = Float64(Float64(1.0 / Float64(z * x)) / Float64(y * z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z * z) <= 2e+51)
		tmp = 1.0 / (x * (y + (y * (z * z))));
	else
		tmp = (1.0 / (z * x)) / (y * z);
	end
	tmp_2 = tmp;
end
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+51], N[(1.0 / N[(x * N[(y + N[(y * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+51}:\\
\;\;\;\;\frac{1}{x \cdot \left(y + y \cdot \left(z \cdot z\right)\right)}\\

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


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

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

    if 2e51 < (*.f64 z z)

    1. Initial program 80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 97.5% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+81}:\\ \;\;\;\;\frac{\frac{1}{y \cdot x}}{1 + z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z \cdot x}}{y \cdot z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= (* z z) 2e+81)
   (/ (/ 1.0 (* y x)) (+ 1.0 (* z z)))
   (/ (/ 1.0 (* z x)) (* y z))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 2e+81) {
		tmp = (1.0 / (y * x)) / (1.0 + (z * z));
	} else {
		tmp = (1.0 / (z * x)) / (y * z);
	}
	return tmp;
}
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+81) then
        tmp = (1.0d0 / (y * x)) / (1.0d0 + (z * z))
    else
        tmp = (1.0d0 / (z * x)) / (y * z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 2e+81) {
		tmp = (1.0 / (y * x)) / (1.0 + (z * z));
	} else {
		tmp = (1.0 / (z * x)) / (y * z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z * z) <= 2e+81:
		tmp = (1.0 / (y * x)) / (1.0 + (z * z))
	else:
		tmp = (1.0 / (z * x)) / (y * z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (Float64(z * z) <= 2e+81)
		tmp = Float64(Float64(1.0 / Float64(y * x)) / Float64(1.0 + Float64(z * z)));
	else
		tmp = Float64(Float64(1.0 / Float64(z * x)) / Float64(y * z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z * z) <= 2e+81)
		tmp = (1.0 / (y * x)) / (1.0 + (z * z));
	else
		tmp = (1.0 / (z * x)) / (y * z);
	end
	tmp_2 = tmp;
end
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+81], N[(N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+81}:\\
\;\;\;\;\frac{\frac{1}{y \cdot x}}{1 + z \cdot z}\\

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


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

    1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.99999999999999984e81 < (*.f64 z z)

    1. Initial program 80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 89.7% accurate, 0.8× speedup?

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

\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) < 1

    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.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < (*.f64 z z)

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 93.4% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{-5}:\\ \;\;\;\;\frac{1}{y \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot \left(z \cdot \left(y \cdot z\right)\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= (* z z) 1e-5) (/ 1.0 (* y x)) (/ 1.0 (* x (* z (* y z))))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1e-5) {
		tmp = 1.0 / (y * x);
	} else {
		tmp = 1.0 / (x * (z * (y * z)));
	}
	return tmp;
}
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-5) then
        tmp = 1.0d0 / (y * x)
    else
        tmp = 1.0d0 / (x * (z * (y * z)))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1e-5) {
		tmp = 1.0 / (y * x);
	} else {
		tmp = 1.0 / (x * (z * (y * z)));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z * z) <= 1e-5:
		tmp = 1.0 / (y * x)
	else:
		tmp = 1.0 / (x * (z * (y * z)))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (Float64(z * z) <= 1e-5)
		tmp = Float64(1.0 / Float64(y * x));
	else
		tmp = Float64(1.0 / Float64(x * Float64(z * Float64(y * z))));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z * z) <= 1e-5)
		tmp = 1.0 / (y * x);
	else
		tmp = 1.0 / (x * (z * (y * z)));
	end
	tmp_2 = tmp;
end
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-5], N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{1}{y \cdot x}\\

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


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

    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.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000008e-5 < (*.f64 z z)

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 93.3% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{-5}:\\ \;\;\;\;\frac{1}{y \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y \cdot \left(z \cdot \left(z \cdot x\right)\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= (* z z) 1e-5) (/ 1.0 (* y x)) (/ 1.0 (* y (* z (* z x))))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1e-5) {
		tmp = 1.0 / (y * x);
	} else {
		tmp = 1.0 / (y * (z * (z * x)));
	}
	return tmp;
}
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-5) then
        tmp = 1.0d0 / (y * x)
    else
        tmp = 1.0d0 / (y * (z * (z * x)))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1e-5) {
		tmp = 1.0 / (y * x);
	} else {
		tmp = 1.0 / (y * (z * (z * x)));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z * z) <= 1e-5:
		tmp = 1.0 / (y * x)
	else:
		tmp = 1.0 / (y * (z * (z * x)))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (Float64(z * z) <= 1e-5)
		tmp = Float64(1.0 / Float64(y * x));
	else
		tmp = Float64(1.0 / Float64(y * Float64(z * Float64(z * x))));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z * z) <= 1e-5)
		tmp = 1.0 / (y * x);
	else
		tmp = 1.0 / (y * (z * (z * x)));
	end
	tmp_2 = tmp;
end
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-5], N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(y * N[(z * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{1}{y \cdot x}\\

\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) < 1.00000000000000008e-5

    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.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000008e-5 < (*.f64 z z)

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 93.8% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{-5}:\\ \;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= (* z z) 1e-5)
   (/ (- 1.0 (* z z)) (* y x))
   (/ (/ 1.0 x) (* z (* y z)))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1e-5) {
		tmp = (1.0 - (z * z)) / (y * x);
	} else {
		tmp = (1.0 / x) / (z * (y * z));
	}
	return tmp;
}
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-5) then
        tmp = (1.0d0 - (z * z)) / (y * x)
    else
        tmp = (1.0d0 / x) / (z * (y * z))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1e-5) {
		tmp = (1.0 - (z * z)) / (y * x);
	} else {
		tmp = (1.0 / x) / (z * (y * z));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z * z) <= 1e-5:
		tmp = (1.0 - (z * z)) / (y * x)
	else:
		tmp = (1.0 / x) / (z * (y * z))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (Float64(z * z) <= 1e-5)
		tmp = Float64(Float64(1.0 - Float64(z * z)) / Float64(y * x));
	else
		tmp = Float64(Float64(1.0 / x) / Float64(z * Float64(y * z)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z * z) <= 1e-5)
		tmp = (1.0 - (z * z)) / (y * x);
	else
		tmp = (1.0 / x) / (z * (y * z));
	end
	tmp_2 = tmp;
end
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-5], N[(N[(1.0 - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\

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


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

    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.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000008e-5 < (*.f64 z z)

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 94.4% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{-5}:\\ \;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z}}{z \cdot \left(y \cdot x\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= (* z z) 1e-5)
   (/ (- 1.0 (* z z)) (* y x))
   (/ (/ 1.0 z) (* z (* y x)))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1e-5) {
		tmp = (1.0 - (z * z)) / (y * x);
	} else {
		tmp = (1.0 / z) / (z * (y * x));
	}
	return tmp;
}
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-5) then
        tmp = (1.0d0 - (z * z)) / (y * x)
    else
        tmp = (1.0d0 / z) / (z * (y * x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1e-5) {
		tmp = (1.0 - (z * z)) / (y * x);
	} else {
		tmp = (1.0 / z) / (z * (y * x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z * z) <= 1e-5:
		tmp = (1.0 - (z * z)) / (y * x)
	else:
		tmp = (1.0 / z) / (z * (y * x))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (Float64(z * z) <= 1e-5)
		tmp = Float64(Float64(1.0 - Float64(z * z)) / Float64(y * x));
	else
		tmp = Float64(Float64(1.0 / z) / Float64(z * Float64(y * x)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z * z) <= 1e-5)
		tmp = (1.0 - (z * z)) / (y * x);
	else
		tmp = (1.0 / z) / (z * (y * x));
	end
	tmp_2 = tmp;
end
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-5], N[(N[(1.0 - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\

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


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

    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.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000008e-5 < (*.f64 z z)

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 96.9% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{-5}:\\ \;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z \cdot x}}{y \cdot z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= (* z z) 1e-5)
   (/ (- 1.0 (* z z)) (* y x))
   (/ (/ 1.0 (* z x)) (* y z))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1e-5) {
		tmp = (1.0 - (z * z)) / (y * x);
	} else {
		tmp = (1.0 / (z * x)) / (y * z);
	}
	return tmp;
}
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-5) then
        tmp = (1.0d0 - (z * z)) / (y * x)
    else
        tmp = (1.0d0 / (z * x)) / (y * z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1e-5) {
		tmp = (1.0 - (z * z)) / (y * x);
	} else {
		tmp = (1.0 / (z * x)) / (y * z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z * z) <= 1e-5:
		tmp = (1.0 - (z * z)) / (y * x)
	else:
		tmp = (1.0 / (z * x)) / (y * z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (Float64(z * z) <= 1e-5)
		tmp = Float64(Float64(1.0 - Float64(z * z)) / Float64(y * x));
	else
		tmp = Float64(Float64(1.0 / Float64(z * x)) / Float64(y * z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z * z) <= 1e-5)
		tmp = (1.0 - (z * z)) / (y * x);
	else
		tmp = (1.0 / (z * x)) / (y * z);
	end
	tmp_2 = tmp;
end
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-5], N[(N[(1.0 - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\

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


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

    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.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000008e-5 < (*.f64 z z)

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 72.6% accurate, 1.0× speedup?

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

\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 z < 0.880000000000000004

    1. Initial program 93.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.880000000000000004 < z

    1. Initial program 82.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 57.8% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Developer target: 92.8% 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 2023280 
(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)))))