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

Percentage Accurate: 90.6% → 97.2%
Time: 8.7s
Alternatives: 5
Speedup: 0.7×

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 5 alternatives:

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

Initial Program: 90.6% accurate, 1.0× speedup?

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

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

Alternative 1: 97.2% accurate, 0.1× speedup?

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

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


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

    1. Initial program 98.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.60000000000000003e185 < (*.f64 z z)

    1. Initial program 78.9%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{1 + z \cdot z}}}{x} \]
      4. associate-/l/76.9%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{y}}{\color{blue}{{z}^{2} \cdot x}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity76.9%

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \cdot \sqrt{x}} \cdot \frac{\frac{1}{y}}{\sqrt{{z}^{2} \cdot x}} \]
      7. add-sqr-sqrt25.5%

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

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

        \[\leadsto \frac{1}{z \cdot \sqrt{x}} \cdot \frac{\frac{1}{y}}{\sqrt{\color{blue}{z \cdot z}} \cdot \sqrt{x}} \]
      10. sqrt-prod18.3%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{z \cdot \sqrt{x}}}}{z \cdot \sqrt{x}} \]
      3. associate-/l/46.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{\color{blue}{-0.5}}}{z}}{y} \cdot \frac{1}{z \cdot \sqrt{x}} \]
      11. *-commutative46.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{1}{\color{blue}{\sqrt{x} \cdot z}} \]
      12. associate-/r*46.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \color{blue}{\frac{\frac{1}{\sqrt{x}}}{z}} \]
      13. metadata-eval46.5%

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{\color{blue}{\sqrt{\frac{1}{x}}}}{z} \]
      15. inv-pow46.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{\sqrt{\color{blue}{{x}^{-1}}}}{z} \]
      16. sqrt-pow146.5%

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{{x}^{\color{blue}{-0.5}}}{z} \]
    12. Applied egg-rr46.5%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5} \cdot {x}^{-0.5}}{y \cdot z}}}{z} \]
      4. pow-sqr95.4%

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

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

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

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

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

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

Alternative 2: 97.9% accurate, 0.1× speedup?

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

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


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

    1. Initial program 98.4%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{1 + z \cdot z}}}{x} \]
      4. associate-/l/99.0%

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

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

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

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

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

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

    if 4.0000000000000001e86 < (*.f64 z z)

    1. Initial program 81.8%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{1 + z \cdot z}}}{x} \]
      4. associate-/l/75.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{\frac{1}{y}}{z \cdot \sqrt{x}}}{z \cdot \sqrt{x}}} \]
      2. *-lft-identity46.9%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{z \cdot \sqrt{x}}}}{z \cdot \sqrt{x}} \]
      3. associate-/l/46.9%

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{z \cdot \left(\sqrt{x} \cdot y\right)}}{z \cdot \sqrt{x}}} \]
    11. Step-by-step derivation
      1. div-inv43.3%

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{z \cdot \sqrt{x}}}{y}} \cdot \frac{1}{z \cdot \sqrt{x}} \]
      4. *-commutative46.9%

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

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

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

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

        \[\leadsto \frac{\frac{\sqrt{\color{blue}{{x}^{-1}}}}{z}}{y} \cdot \frac{1}{z \cdot \sqrt{x}} \]
      9. sqrt-pow147.0%

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

        \[\leadsto \frac{\frac{{x}^{\color{blue}{-0.5}}}{z}}{y} \cdot \frac{1}{z \cdot \sqrt{x}} \]
      11. *-commutative47.0%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{1}{\color{blue}{\sqrt{x} \cdot z}} \]
      12. associate-/r*47.0%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \color{blue}{\frac{\frac{1}{\sqrt{x}}}{z}} \]
      13. metadata-eval47.0%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{\frac{\color{blue}{\sqrt{1}}}{\sqrt{x}}}{z} \]
      14. sqrt-div47.0%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{\color{blue}{\sqrt{\frac{1}{x}}}}{z} \]
      15. inv-pow47.0%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{\sqrt{\color{blue}{{x}^{-1}}}}{z} \]
      16. sqrt-pow147.0%

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{{x}^{\color{blue}{-0.5}}}{z} \]
    12. Applied egg-rr47.0%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5} \cdot {x}^{-0.5}}{y \cdot z}}}{z} \]
      4. pow-sqr96.0%

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

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

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

        \[\leadsto \frac{\frac{\frac{1}{x}}{\color{blue}{z \cdot y}}}{z} \]
    14. Simplified96.0%

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

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

Alternative 3: 97.8% accurate, 0.7× speedup?

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

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


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

    1. Initial program 99.7%

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

    if 1.0000000000000001e50 < (*.f64 z z)

    1. Initial program 81.9%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{1 + z \cdot z}}}{x} \]
      4. associate-/l/76.6%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{y}}{\color{blue}{{z}^{2} \cdot x}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity76.6%

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \cdot \sqrt{x}} \cdot \frac{\frac{1}{y}}{\sqrt{{z}^{2} \cdot x}} \]
      7. add-sqr-sqrt25.7%

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

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

        \[\leadsto \frac{1}{z \cdot \sqrt{x}} \cdot \frac{\frac{1}{y}}{\sqrt{\color{blue}{z \cdot z}} \cdot \sqrt{x}} \]
      10. sqrt-prod22.5%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{z \cdot \sqrt{x}}}}{z \cdot \sqrt{x}} \]
      3. associate-/l/46.8%

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{z \cdot \left(\sqrt{x} \cdot y\right)}}{z \cdot \sqrt{x}}} \]
    11. Step-by-step derivation
      1. div-inv43.5%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{\frac{1}{x}}}}{z}}{y} \cdot \frac{1}{z \cdot \sqrt{x}} \]
      8. inv-pow46.8%

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

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

        \[\leadsto \frac{\frac{{x}^{\color{blue}{-0.5}}}{z}}{y} \cdot \frac{1}{z \cdot \sqrt{x}} \]
      11. *-commutative46.9%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{1}{\color{blue}{\sqrt{x} \cdot z}} \]
      12. associate-/r*46.8%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \color{blue}{\frac{\frac{1}{\sqrt{x}}}{z}} \]
      13. metadata-eval46.8%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{\frac{\color{blue}{\sqrt{1}}}{\sqrt{x}}}{z} \]
      14. sqrt-div46.8%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{\color{blue}{\sqrt{\frac{1}{x}}}}{z} \]
      15. inv-pow46.8%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{\sqrt{\color{blue}{{x}^{-1}}}}{z} \]
      16. sqrt-pow146.8%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5} \cdot {x}^{-0.5}}{y \cdot z}}}{z} \]
      4. pow-sqr96.3%

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

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

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

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

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

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

Alternative 4: 78.0% 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{\frac{\frac{1}{x}}{z \cdot y}}{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 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(Float64(Float64(1.0 / x) / Float64(z * 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[(N[(N[(1.0 / x), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision] / z), $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{\frac{\frac{1}{x}}{z \cdot y}}{z}\\


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

    1. Initial program 94.9%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{1 + z \cdot z}}}{x} \]
      4. associate-/l/94.8%

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

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

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

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

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

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

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

    if 1 < z

    1. Initial program 80.2%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{1 + z \cdot z}}}{x} \]
      4. associate-/l/70.1%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{y}}{\color{blue}{{z}^{2} \cdot x}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity69.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{z \cdot \sqrt{x}}}}{z \cdot \sqrt{x}} \]
      3. associate-/l/47.3%

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{z \cdot \left(\sqrt{x} \cdot y\right)}}{z \cdot \sqrt{x}}} \]
    11. Step-by-step derivation
      1. div-inv42.3%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{\frac{1}{x}}}}{z}}{y} \cdot \frac{1}{z \cdot \sqrt{x}} \]
      8. inv-pow47.4%

        \[\leadsto \frac{\frac{\sqrt{\color{blue}{{x}^{-1}}}}{z}}{y} \cdot \frac{1}{z \cdot \sqrt{x}} \]
      9. sqrt-pow147.3%

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

        \[\leadsto \frac{\frac{{x}^{\color{blue}{-0.5}}}{z}}{y} \cdot \frac{1}{z \cdot \sqrt{x}} \]
      11. *-commutative47.3%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{1}{\color{blue}{\sqrt{x} \cdot z}} \]
      12. associate-/r*47.3%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \color{blue}{\frac{\frac{1}{\sqrt{x}}}{z}} \]
      13. metadata-eval47.3%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{\frac{\color{blue}{\sqrt{1}}}{\sqrt{x}}}{z} \]
      14. sqrt-div47.3%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{\color{blue}{\sqrt{\frac{1}{x}}}}{z} \]
      15. inv-pow47.3%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{\sqrt{\color{blue}{{x}^{-1}}}}{z} \]
      16. sqrt-pow147.2%

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{z}}{y} \cdot \frac{{x}^{\color{blue}{-0.5}}}{z} \]
    12. Applied egg-rr47.2%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5} \cdot {x}^{-0.5}}{y \cdot z}}}{z} \]
      4. pow-sqr96.4%

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

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

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

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

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

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

Alternative 5: 57.8% accurate, 2.2× speedup?

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

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

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

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

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

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

Developer target: 92.7% 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 2023308 
(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)))))