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

Percentage Accurate: 90.8% → 97.5%
Time: 9.9s
Alternatives: 15
Speedup: 1.0×

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 15 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: 97.5% accurate, 0.1× speedup?

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

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


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

    1. Initial program 94.1%

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

    if 9.9999999999999994e304 < (*.f64 y (+.f64 1 (*.f64 z z)))

    1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{z \cdot z + 1}} \]
      10. fma-udef81.6%

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{\mathsf{fma}\left(z, z, 1\right)}} \]
      11. add-sqr-sqrt81.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)}}} \]
      12. times-frac81.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)}}} \]
      13. fma-udef81.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)}} \]
      14. +-commutative81.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)}} \]
      15. hypot-1-def81.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)}} \]
      16. fma-udef81.6%

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

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

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

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

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

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

Alternative 2: 97.6% accurate, 0.1× speedup?

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

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


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

    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*98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999993e167 < (*.f64 z z)

    1. Initial program 78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{z \cdot z + 1}} \]
      10. fma-udef83.2%

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

        \[\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)}}} \]
      12. times-frac83.1%

        \[\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)}}} \]
      13. fma-udef83.1%

        \[\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)}} \]
      14. +-commutative83.1%

        \[\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)}} \]
      15. hypot-1-def83.1%

        \[\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)}} \]
      16. fma-udef83.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.3% accurate, 0.1× speedup?

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

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


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

    1. Initial program 96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{z \cdot z + 1}} \]
      10. fma-udef98.4%

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

        \[\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)}}} \]
      12. times-frac98.3%

        \[\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)}}} \]
      13. fma-udef98.3%

        \[\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)}} \]
      14. +-commutative98.3%

        \[\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)}} \]
      15. hypot-1-def98.3%

        \[\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)}} \]
      16. fma-udef98.3%

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

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

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

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

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

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

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

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

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

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

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

    if 3.0000000000000002e289 < (*.f64 z z)

    1. Initial program 75.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{z \cdot z + 1}} \]
      10. fma-udef76.4%

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

        \[\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)}}} \]
      12. times-frac76.4%

        \[\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)}}} \]
      13. fma-udef76.4%

        \[\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)}} \]
      14. +-commutative76.4%

        \[\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)}} \]
      15. hypot-1-def76.4%

        \[\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)}} \]
      16. fma-udef76.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 96.6% accurate, 0.6× speedup?

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

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


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

    1. Initial program 94.1%

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

    if 9.9999999999999994e304 < (*.f64 y (+.f64 1 (*.f64 z z)))

    1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 94.1% accurate, 0.6× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{z \cdot z + 1}} \]
      10. fma-udef99.2%

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

        \[\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)}}} \]
      12. times-frac99.2%

        \[\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)}}} \]
      13. fma-udef99.2%

        \[\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)}} \]
      14. +-commutative99.2%

        \[\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)}} \]
      15. hypot-1-def99.2%

        \[\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)}} \]
      16. fma-udef99.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    10. Simplified98.3%

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

    if 1.99999999999999991e-6 < (*.f64 z z) < 5.00000000000000031e289

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{z \cdot z + 1}} \]
      10. fma-udef97.1%

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{\mathsf{fma}\left(z, z, 1\right)}} \]
      11. add-sqr-sqrt97.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)}}} \]
      12. times-frac96.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)}}} \]
      13. fma-udef96.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)}} \]
      14. +-commutative96.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)}} \]
      15. hypot-1-def96.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)}} \]
      16. fma-udef96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000031e289 < (*.f64 z z)

    1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 96.7% accurate, 0.7× speedup?

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.99999999999999991e-6 < (*.f64 z z)

    1. Initial program 84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity88.7%

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

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

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

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

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

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

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

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

Alternative 7: 97.5% accurate, 0.7× speedup?

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

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


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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999976e73 < (*.f64 z 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.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity88.6%

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

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

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

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

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

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

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

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

Alternative 8: 97.3% accurate, 0.7× speedup?

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

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


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

    1. Initial program 95.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{z \cdot z + 1}} \]
      10. fma-udef98.0%

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{\mathsf{fma}\left(z, z, 1\right)}} \]
      11. add-sqr-sqrt97.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)}}} \]
      12. times-frac97.9%

        \[\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)}}} \]
      13. fma-udef97.9%

        \[\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)}} \]
      14. +-commutative97.9%

        \[\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)}} \]
      15. hypot-1-def97.9%

        \[\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)}} \]
      16. fma-udef97.9%

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

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

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

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

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

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

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

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

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

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

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

    if 1.99999999999999997e307 < (*.f64 z z)

    1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity89.7%

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

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

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

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

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

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

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

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

Alternative 9: 94.2% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 96.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.859999999999999987 < z < 2.49999999999999983e145

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{\mathsf{fma}\left(z, z, 1\right)}} \]
      11. add-sqr-sqrt95.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)}}} \]
      12. times-frac95.4%

        \[\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)}}} \]
      13. fma-udef95.4%

        \[\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)}} \]
      14. +-commutative95.4%

        \[\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)}} \]
      15. hypot-1-def95.4%

        \[\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)}} \]
      16. fma-udef95.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.49999999999999983e145 < z

    1. Initial program 68.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 94.3% accurate, 0.8× speedup?

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

\mathbf{elif}\;z \leq 6.6 \cdot 10^{+145}:\\
\;\;\;\;\frac{\frac{\frac{1}{y}}{x}}{z \cdot z}\\

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


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

    1. Initial program 96.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.859999999999999987 < z < 6.60000000000000054e145

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{\mathsf{fma}\left(z, z, 1\right)}} \]
      11. add-sqr-sqrt95.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)}}} \]
      12. times-frac95.4%

        \[\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)}}} \]
      13. fma-udef95.4%

        \[\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)}} \]
      14. +-commutative95.4%

        \[\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)}} \]
      15. hypot-1-def95.4%

        \[\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)}} \]
      16. fma-udef95.4%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x \cdot y}}{1 + z \cdot z}} \]
    8. Taylor expanded in z around inf 86.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y}}{x}}{z \cdot z}} \]
    10. Simplified92.1%

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

    if 6.60000000000000054e145 < z

    1. Initial program 68.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 93.9% accurate, 1.0× speedup?

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

    1. Initial program 96.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{z \cdot z + 1}} \]
      10. fma-udef96.2%

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

        \[\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)}}} \]
      12. times-frac96.1%

        \[\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)}}} \]
      13. fma-udef96.1%

        \[\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)}} \]
      14. +-commutative96.1%

        \[\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)}} \]
      15. hypot-1-def96.1%

        \[\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)}} \]
      16. fma-udef96.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    10. Simplified72.5%

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

    if 1 < z

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 70.1% accurate, 1.2× speedup?

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

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


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

    1. Initial program 96.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{z \cdot z + 1}} \]
      10. fma-udef96.2%

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

        \[\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)}}} \]
      12. times-frac96.1%

        \[\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)}}} \]
      13. fma-udef96.1%

        \[\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)}} \]
      14. +-commutative96.1%

        \[\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)}} \]
      15. hypot-1-def96.1%

        \[\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)}} \]
      16. fma-udef96.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    10. Simplified72.5%

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

    if 1 < z

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{z \cdot z + 1}} \]
      10. fma-udef85.6%

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

        \[\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)}}} \]
      12. times-frac85.4%

        \[\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)}}} \]
      13. fma-udef85.4%

        \[\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)}} \]
      14. +-commutative85.4%

        \[\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)}} \]
      15. hypot-1-def85.4%

        \[\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)}} \]
      16. fma-udef85.4%

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

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

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

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

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

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

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

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

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

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

Alternative 13: 59.1% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

    \[\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}{y \cdot x}} \]
  5. Final simplification56.2%

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

Alternative 14: 59.1% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

    \[\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}{y \cdot x}} \]
  5. Step-by-step derivation
    1. associate-/r*56.3%

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

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

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

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

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

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

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

Alternative 15: 59.1% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{z \cdot z + 1}} \]
    10. fma-udef93.1%

      \[\leadsto \frac{1 \cdot \frac{1}{x \cdot y}}{\color{blue}{\mathsf{fma}\left(z, z, 1\right)}} \]
    11. add-sqr-sqrt93.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)}}} \]
    12. times-frac93.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)}}} \]
    13. fma-udef93.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)}} \]
    14. +-commutative93.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)}} \]
    15. hypot-1-def93.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)}} \]
    16. fma-udef93.0%

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{x \cdot y}}{\color{blue}{\sqrt{1 \cdot 1 + z \cdot z}} \cdot \mathsf{hypot}\left(1, z\right)} \]
    4. hypot-udef93.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}}} \]
    5. add-sqr-sqrt93.1%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
  10. Simplified56.3%

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

    \[\leadsto \frac{\frac{1}{y}}{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 2023309 
(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)))))