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

Percentage Accurate: 90.5% → 99.1%
Time: 8.3s
Alternatives: 12
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 90.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.1% accurate, 0.4× speedup?

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

\mathbf{elif}\;t_0 \leq 10^{+308}:\\
\;\;\;\;\frac{\frac{1}{x}}{t_0}\\

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


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

    1. Initial program 73.0%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.6%

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

    if 1e308 < (*.f64 y (+.f64 1 (*.f64 z z)))

    1. Initial program 67.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.6% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 92.2% accurate, 0.1× speedup?

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

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


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

    1. Initial program 98.1%

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

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

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

    if 5.0000000000000002e205 < (*.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.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + z \cdot z}} \cdot \frac{\frac{\frac{1}{x}}{y}}{\sqrt{1 + z \cdot z}}} \]
      8. hypot-1-def70.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 96.8% accurate, 0.7× speedup?

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

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


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

    1. Initial program 99.7%

      \[\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 \left(y \cdot \color{blue}{\left(z \cdot z + 1\right)}\right)} \]
      3. fma-def98.6%

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

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

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

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

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

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

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

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

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

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 96.8% accurate, 0.7× speedup?

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

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


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

    1. Initial program 99.7%

      \[\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 \left(y \cdot \color{blue}{\left(z \cdot z + 1\right)}\right)} \]
      3. fma-def98.6%

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

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

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

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

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

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

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

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

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

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + z \cdot z}} \cdot \frac{\frac{\frac{1}{x}}{y}}{\sqrt{1 + z \cdot z}}} \]
      8. hypot-1-def79.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 97.6% accurate, 0.7× speedup?

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

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


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

    1. Initial program 98.1%

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

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

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

    if 5.0000000000000002e205 < (*.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.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + z \cdot z}} \cdot \frac{\frac{\frac{1}{x}}{y}}{\sqrt{1 + z \cdot z}}} \]
      8. hypot-1-def70.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 93.5% accurate, 0.8× speedup?

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

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


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

    1. Initial program 99.7%

      \[\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 \left(y \cdot \color{blue}{\left(z \cdot z + 1\right)}\right)} \]
      3. fma-def98.6%

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

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

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

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

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

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

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

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

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

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + z \cdot z}} \cdot \frac{\frac{\frac{1}{x}}{y}}{\sqrt{1 + z \cdot z}}} \]
      8. hypot-1-def79.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 96.8% accurate, 0.8× speedup?

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

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


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

    1. Initial program 99.7%

      \[\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 \left(y \cdot \color{blue}{\left(z \cdot z + 1\right)}\right)} \]
      3. fma-def98.6%

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

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

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

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

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

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

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

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

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

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 76.4% accurate, 1.0× speedup?

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

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


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

    1. Initial program 96.9%

      \[\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 \left(y \cdot \color{blue}{\left(z \cdot z + 1\right)}\right)} \]
      3. fma-def96.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    7. Step-by-step derivation
      1. un-div-inv77.3%

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

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

    if 1 < z

    1. Initial program 74.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 58.8% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

Alternative 11: 58.9% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{y}} \]
  12. Simplified62.4%

    \[\leadsto \color{blue}{\frac{\frac{1}{x}}{y}} \]
  13. Final simplification62.4%

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

Alternative 12: 58.9% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
  7. Step-by-step derivation
    1. un-div-inv62.4%

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

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

    \[\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 2023221 
(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)))))