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

Percentage Accurate: 91.6% → 97.0%
Time: 3.1s
Alternatives: 7
Speedup: N/A×

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)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    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 7 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: 91.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)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    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.0% accurate, N/A× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.12000000000000001e-18

    1. Initial program 90.3%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(1 + z \cdot z\right)}} \]
      2. lift-+.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(1 + z \cdot z\right)}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{z \cdot z}\right)} \]
      4. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{{z}^{2}}\right)} \]
      5. distribute-lft-inN/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot 1 + y \cdot {z}^{2}}} \]
      6. *-rgt-identityN/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y} + y \cdot {z}^{2}} \]
      7. +-commutativeN/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot {z}^{2} + y}} \]
      8. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(z \cdot z\right)} + y} \]
      9. sqr-neg-revN/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + y} \]
      10. associate-*r*N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\left(y \cdot \left(\mathsf{neg}\left(z\right)\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)} + y} \]
      11. lower-fma.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\mathsf{fma}\left(y \cdot \left(\mathsf{neg}\left(z\right)\right), \mathsf{neg}\left(z\right), y\right)}} \]
      12. lower-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\mathsf{fma}\left(\color{blue}{y \cdot \left(\mathsf{neg}\left(z\right)\right)}, \mathsf{neg}\left(z\right), y\right)} \]
      13. lower-neg.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\mathsf{fma}\left(y \cdot \color{blue}{\left(-z\right)}, \mathsf{neg}\left(z\right), y\right)} \]
      14. lower-neg.f6496.7

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

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

    if 1.12000000000000001e-18 < y

    1. Initial program 93.1%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{y \cdot \left(1 + z \cdot z\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(1 + z \cdot z\right)}} \]
      4. lift-+.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(1 + z \cdot z\right)}} \]
      5. lift-*.f64N/A

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

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{1}{x}}{1 + z \cdot z}}{y}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{\frac{1}{x}}{1 + z \cdot z}}{y}} \]
      9. lower-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{1 + z \cdot z}}}{y} \]
      10. inv-powN/A

        \[\leadsto \frac{\frac{\color{blue}{{x}^{-1}}}{1 + z \cdot z}}{y} \]
      11. lower-pow.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{{x}^{-1}}}{1 + z \cdot z}}{y} \]
      12. pow2N/A

        \[\leadsto \frac{\frac{{x}^{-1}}{1 + \color{blue}{{z}^{2}}}}{y} \]
      13. +-commutativeN/A

        \[\leadsto \frac{\frac{{x}^{-1}}{\color{blue}{{z}^{2} + 1}}}{y} \]
      14. pow2N/A

        \[\leadsto \frac{\frac{{x}^{-1}}{\color{blue}{z \cdot z} + 1}}{y} \]
      15. lower-fma.f6497.2

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

      \[\leadsto \color{blue}{\frac{\frac{{x}^{-1}}{\mathsf{fma}\left(z, z, 1\right)}}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 96.8% accurate, N/A× speedup?

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

\mathbf{else}:\\
\;\;\;\;{\left(y \cdot x\right)}^{-1} \cdot {\left(\mathsf{fma}\left(z, z, 1\right)\right)}^{-1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.00000000000000001e-35

    1. Initial program 90.1%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(1 + z \cdot z\right)}} \]
      2. lift-+.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(1 + z \cdot z\right)}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{z \cdot z}\right)} \]
      4. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{{z}^{2}}\right)} \]
      5. distribute-lft-inN/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot 1 + y \cdot {z}^{2}}} \]
      6. *-rgt-identityN/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y} + y \cdot {z}^{2}} \]
      7. +-commutativeN/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot {z}^{2} + y}} \]
      8. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(z \cdot z\right)} + y} \]
      9. sqr-neg-revN/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + y} \]
      10. associate-*r*N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\left(y \cdot \left(\mathsf{neg}\left(z\right)\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)} + y} \]
      11. lower-fma.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\mathsf{fma}\left(y \cdot \left(\mathsf{neg}\left(z\right)\right), \mathsf{neg}\left(z\right), y\right)}} \]
      12. lower-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\mathsf{fma}\left(\color{blue}{y \cdot \left(\mathsf{neg}\left(z\right)\right)}, \mathsf{neg}\left(z\right), y\right)} \]
      13. lower-neg.f64N/A

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

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

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

    if 1.00000000000000001e-35 < y

    1. Initial program 93.5%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{y \cdot \left(1 + z \cdot z\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(1 + z \cdot z\right)}} \]
      4. lift-+.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(1 + z \cdot z\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{z \cdot z}\right)} \]
      6. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{{z}^{2}}\right)} \]
      7. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)}} \]
      8. inv-powN/A

        \[\leadsto \color{blue}{{\left(x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)\right)}^{-1}} \]
      9. associate-*r*N/A

        \[\leadsto {\color{blue}{\left(\left(x \cdot y\right) \cdot \left(1 + {z}^{2}\right)\right)}}^{-1} \]
      10. pow2N/A

        \[\leadsto {\left(\left(x \cdot y\right) \cdot \left(1 + \color{blue}{z \cdot z}\right)\right)}^{-1} \]
      11. unpow-prod-downN/A

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{-1} \cdot {\left(1 + z \cdot z\right)}^{-1}} \]
      12. inv-powN/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot y}} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      13. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot y} \cdot {\left(1 + z \cdot z\right)}^{-1}} \]
      14. inv-powN/A

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{-1}} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      15. lower-pow.f64N/A

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{-1}} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      16. *-commutativeN/A

        \[\leadsto {\color{blue}{\left(y \cdot x\right)}}^{-1} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      17. lower-*.f64N/A

        \[\leadsto {\color{blue}{\left(y \cdot x\right)}}^{-1} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      18. lower-pow.f64N/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot \color{blue}{{\left(1 + z \cdot z\right)}^{-1}} \]
      19. pow2N/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\left(1 + \color{blue}{{z}^{2}}\right)}^{-1} \]
      20. +-commutativeN/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\color{blue}{\left({z}^{2} + 1\right)}}^{-1} \]
      21. pow2N/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\left(\color{blue}{z \cdot z} + 1\right)}^{-1} \]
      22. lower-fma.f6497.0

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\color{blue}{\left(\mathsf{fma}\left(z, z, 1\right)\right)}}^{-1} \]
    4. Applied rewrites97.0%

      \[\leadsto \color{blue}{{\left(y \cdot x\right)}^{-1} \cdot {\left(\mathsf{fma}\left(z, z, 1\right)\right)}^{-1}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 93.4% accurate, N/A× speedup?

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

\mathbf{else}:\\
\;\;\;\;{\left(y \cdot x\right)}^{-1} \cdot {\left(\mathsf{fma}\left(z, z, 1\right)\right)}^{-1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 2.00000000000000012e279

    1. Initial program 95.1%

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

    if 2.00000000000000012e279 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 77.3%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{y \cdot \left(1 + z \cdot z\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(1 + z \cdot z\right)}} \]
      4. lift-+.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(1 + z \cdot z\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{z \cdot z}\right)} \]
      6. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{{z}^{2}}\right)} \]
      7. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)}} \]
      8. inv-powN/A

        \[\leadsto \color{blue}{{\left(x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)\right)}^{-1}} \]
      9. associate-*r*N/A

        \[\leadsto {\color{blue}{\left(\left(x \cdot y\right) \cdot \left(1 + {z}^{2}\right)\right)}}^{-1} \]
      10. pow2N/A

        \[\leadsto {\left(\left(x \cdot y\right) \cdot \left(1 + \color{blue}{z \cdot z}\right)\right)}^{-1} \]
      11. unpow-prod-downN/A

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{-1} \cdot {\left(1 + z \cdot z\right)}^{-1}} \]
      12. inv-powN/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot y}} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      13. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot y} \cdot {\left(1 + z \cdot z\right)}^{-1}} \]
      14. inv-powN/A

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{-1}} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      15. lower-pow.f64N/A

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{-1}} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      16. *-commutativeN/A

        \[\leadsto {\color{blue}{\left(y \cdot x\right)}}^{-1} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      17. lower-*.f64N/A

        \[\leadsto {\color{blue}{\left(y \cdot x\right)}}^{-1} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      18. lower-pow.f64N/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot \color{blue}{{\left(1 + z \cdot z\right)}^{-1}} \]
      19. pow2N/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\left(1 + \color{blue}{{z}^{2}}\right)}^{-1} \]
      20. +-commutativeN/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\color{blue}{\left({z}^{2} + 1\right)}}^{-1} \]
      21. pow2N/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\left(\color{blue}{z \cdot z} + 1\right)}^{-1} \]
      22. lower-fma.f6481.9

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\color{blue}{\left(\mathsf{fma}\left(z, z, 1\right)\right)}}^{-1} \]
    4. Applied rewrites81.9%

      \[\leadsto \color{blue}{{\left(y \cdot x\right)}^{-1} \cdot {\left(\mathsf{fma}\left(z, z, 1\right)\right)}^{-1}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 93.3% accurate, N/A× speedup?

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

\mathbf{else}:\\
\;\;\;\;{\left(y \cdot x\right)}^{-1} \cdot {\left(\mathsf{fma}\left(z, z, 1\right)\right)}^{-1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 1.99999999999999992e275

    1. Initial program 95.1%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{y \cdot \left(1 + z \cdot z\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(1 + z \cdot z\right)}} \]
      4. lift-+.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(1 + z \cdot z\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{z \cdot z}\right)} \]
      6. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{{z}^{2}}\right)} \]
      7. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)}} \]
      8. inv-powN/A

        \[\leadsto \color{blue}{{\left(x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)\right)}^{-1}} \]
      9. *-commutativeN/A

        \[\leadsto {\color{blue}{\left(\left(y \cdot \left(1 + {z}^{2}\right)\right) \cdot x\right)}}^{-1} \]
      10. pow2N/A

        \[\leadsto {\left(\left(y \cdot \left(1 + \color{blue}{z \cdot z}\right)\right) \cdot x\right)}^{-1} \]
      11. unpow-prod-downN/A

        \[\leadsto \color{blue}{{\left(y \cdot \left(1 + z \cdot z\right)\right)}^{-1} \cdot {x}^{-1}} \]
      12. inv-powN/A

        \[\leadsto {\left(y \cdot \left(1 + z \cdot z\right)\right)}^{-1} \cdot \color{blue}{\frac{1}{x}} \]
      13. lower-*.f64N/A

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

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

    if 1.99999999999999992e275 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 78.0%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{y \cdot \left(1 + z \cdot z\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(1 + z \cdot z\right)}} \]
      4. lift-+.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(1 + z \cdot z\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{z \cdot z}\right)} \]
      6. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{{z}^{2}}\right)} \]
      7. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)}} \]
      8. inv-powN/A

        \[\leadsto \color{blue}{{\left(x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)\right)}^{-1}} \]
      9. associate-*r*N/A

        \[\leadsto {\color{blue}{\left(\left(x \cdot y\right) \cdot \left(1 + {z}^{2}\right)\right)}}^{-1} \]
      10. pow2N/A

        \[\leadsto {\left(\left(x \cdot y\right) \cdot \left(1 + \color{blue}{z \cdot z}\right)\right)}^{-1} \]
      11. unpow-prod-downN/A

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{-1} \cdot {\left(1 + z \cdot z\right)}^{-1}} \]
      12. inv-powN/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot y}} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      13. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot y} \cdot {\left(1 + z \cdot z\right)}^{-1}} \]
      14. inv-powN/A

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{-1}} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      15. lower-pow.f64N/A

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{-1}} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      16. *-commutativeN/A

        \[\leadsto {\color{blue}{\left(y \cdot x\right)}}^{-1} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      17. lower-*.f64N/A

        \[\leadsto {\color{blue}{\left(y \cdot x\right)}}^{-1} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      18. lower-pow.f64N/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot \color{blue}{{\left(1 + z \cdot z\right)}^{-1}} \]
      19. pow2N/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\left(1 + \color{blue}{{z}^{2}}\right)}^{-1} \]
      20. +-commutativeN/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\color{blue}{\left({z}^{2} + 1\right)}}^{-1} \]
      21. pow2N/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\left(\color{blue}{z \cdot z} + 1\right)}^{-1} \]
      22. lower-fma.f6482.5

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\color{blue}{\left(\mathsf{fma}\left(z, z, 1\right)\right)}}^{-1} \]
    4. Applied rewrites82.5%

      \[\leadsto \color{blue}{{\left(y \cdot x\right)}^{-1} \cdot {\left(\mathsf{fma}\left(z, z, 1\right)\right)}^{-1}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 74.6% accurate, N/A× speedup?

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

\mathbf{else}:\\
\;\;\;\;{\left(y \cdot x\right)}^{-1} \cdot {\left(\mathsf{fma}\left(z, z, 1\right)\right)}^{-1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 2.00000000000000012e279

    1. Initial program 95.1%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{y \cdot \left(1 + z \cdot z\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(1 + z \cdot z\right)}} \]
      4. lift-+.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(1 + z \cdot z\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{z \cdot z}\right)} \]
      6. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{{z}^{2}}\right)} \]
      7. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)}} \]
      8. inv-powN/A

        \[\leadsto \color{blue}{{\left(x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)\right)}^{-1}} \]
      9. *-commutativeN/A

        \[\leadsto {\color{blue}{\left(\left(y \cdot \left(1 + {z}^{2}\right)\right) \cdot x\right)}}^{-1} \]
      10. pow2N/A

        \[\leadsto {\left(\left(y \cdot \left(1 + \color{blue}{z \cdot z}\right)\right) \cdot x\right)}^{-1} \]
      11. unpow-prod-downN/A

        \[\leadsto \color{blue}{{\left(y \cdot \left(1 + z \cdot z\right)\right)}^{-1} \cdot {x}^{-1}} \]
      12. inv-powN/A

        \[\leadsto {\left(y \cdot \left(1 + z \cdot z\right)\right)}^{-1} \cdot \color{blue}{\frac{1}{x}} \]
      13. lower-*.f64N/A

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

      \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(z, z, 1\right) \cdot y\right)}^{-1} \cdot {x}^{-1}} \]
    5. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(z, z, 1\right) \cdot y\right)}^{-1}} \cdot {x}^{-1} \]
      2. lift-*.f64N/A

        \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(z, z, 1\right) \cdot y\right)}}^{-1} \cdot {x}^{-1} \]
      3. lift-fma.f64N/A

        \[\leadsto {\left(\color{blue}{\left(z \cdot z + 1\right)} \cdot y\right)}^{-1} \cdot {x}^{-1} \]
      4. sqr-powN/A

        \[\leadsto \color{blue}{\left({\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right)} \cdot {x}^{-1} \]
      5. lower-*.f64N/A

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

        \[\leadsto \left({\color{blue}{\left(y \cdot \left(z \cdot z + 1\right)\right)}}^{\left(\frac{-1}{2}\right)} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      7. pow2N/A

        \[\leadsto \left({\left(y \cdot \left(\color{blue}{{z}^{2}} + 1\right)\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      8. +-commutativeN/A

        \[\leadsto \left({\left(y \cdot \color{blue}{\left(1 + {z}^{2}\right)}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      9. pow2N/A

        \[\leadsto \left({\left(y \cdot \left(1 + \color{blue}{z \cdot z}\right)\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      10. metadata-evalN/A

        \[\leadsto \left({\left(y \cdot \left(1 + z \cdot z\right)\right)}^{\color{blue}{\frac{-1}{2}}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      11. lower-pow.f64N/A

        \[\leadsto \left(\color{blue}{{\left(y \cdot \left(1 + z \cdot z\right)\right)}^{\frac{-1}{2}}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      12. pow2N/A

        \[\leadsto \left({\left(y \cdot \left(1 + \color{blue}{{z}^{2}}\right)\right)}^{\frac{-1}{2}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      13. +-commutativeN/A

        \[\leadsto \left({\left(y \cdot \color{blue}{\left({z}^{2} + 1\right)}\right)}^{\frac{-1}{2}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      14. pow2N/A

        \[\leadsto \left({\left(y \cdot \left(\color{blue}{z \cdot z} + 1\right)\right)}^{\frac{-1}{2}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      15. *-commutativeN/A

        \[\leadsto \left({\color{blue}{\left(\left(z \cdot z + 1\right) \cdot y\right)}}^{\frac{-1}{2}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      16. lift-fma.f64N/A

        \[\leadsto \left({\left(\color{blue}{\mathsf{fma}\left(z, z, 1\right)} \cdot y\right)}^{\frac{-1}{2}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      17. lift-*.f64N/A

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

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

    if 2.00000000000000012e279 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 77.3%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{y \cdot \left(1 + z \cdot z\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(1 + z \cdot z\right)}} \]
      4. lift-+.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(1 + z \cdot z\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{z \cdot z}\right)} \]
      6. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{{z}^{2}}\right)} \]
      7. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)}} \]
      8. inv-powN/A

        \[\leadsto \color{blue}{{\left(x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)\right)}^{-1}} \]
      9. associate-*r*N/A

        \[\leadsto {\color{blue}{\left(\left(x \cdot y\right) \cdot \left(1 + {z}^{2}\right)\right)}}^{-1} \]
      10. pow2N/A

        \[\leadsto {\left(\left(x \cdot y\right) \cdot \left(1 + \color{blue}{z \cdot z}\right)\right)}^{-1} \]
      11. unpow-prod-downN/A

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{-1} \cdot {\left(1 + z \cdot z\right)}^{-1}} \]
      12. inv-powN/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot y}} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      13. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot y} \cdot {\left(1 + z \cdot z\right)}^{-1}} \]
      14. inv-powN/A

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{-1}} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      15. lower-pow.f64N/A

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{-1}} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      16. *-commutativeN/A

        \[\leadsto {\color{blue}{\left(y \cdot x\right)}}^{-1} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      17. lower-*.f64N/A

        \[\leadsto {\color{blue}{\left(y \cdot x\right)}}^{-1} \cdot {\left(1 + z \cdot z\right)}^{-1} \]
      18. lower-pow.f64N/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot \color{blue}{{\left(1 + z \cdot z\right)}^{-1}} \]
      19. pow2N/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\left(1 + \color{blue}{{z}^{2}}\right)}^{-1} \]
      20. +-commutativeN/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\color{blue}{\left({z}^{2} + 1\right)}}^{-1} \]
      21. pow2N/A

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\left(\color{blue}{z \cdot z} + 1\right)}^{-1} \]
      22. lower-fma.f6481.9

        \[\leadsto {\left(y \cdot x\right)}^{-1} \cdot {\color{blue}{\left(\mathsf{fma}\left(z, z, 1\right)\right)}}^{-1} \]
    4. Applied rewrites81.9%

      \[\leadsto \color{blue}{{\left(y \cdot x\right)}^{-1} \cdot {\left(\mathsf{fma}\left(z, z, 1\right)\right)}^{-1}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 74.5% accurate, N/A× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 1.00000000000000007e260

    1. Initial program 95.1%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{y \cdot \left(1 + z \cdot z\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(1 + z \cdot z\right)}} \]
      4. lift-+.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(1 + z \cdot z\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{z \cdot z}\right)} \]
      6. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{{z}^{2}}\right)} \]
      7. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{1}{x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)}} \]
      8. inv-powN/A

        \[\leadsto \color{blue}{{\left(x \cdot \left(y \cdot \left(1 + {z}^{2}\right)\right)\right)}^{-1}} \]
      9. *-commutativeN/A

        \[\leadsto {\color{blue}{\left(\left(y \cdot \left(1 + {z}^{2}\right)\right) \cdot x\right)}}^{-1} \]
      10. pow2N/A

        \[\leadsto {\left(\left(y \cdot \left(1 + \color{blue}{z \cdot z}\right)\right) \cdot x\right)}^{-1} \]
      11. unpow-prod-downN/A

        \[\leadsto \color{blue}{{\left(y \cdot \left(1 + z \cdot z\right)\right)}^{-1} \cdot {x}^{-1}} \]
      12. inv-powN/A

        \[\leadsto {\left(y \cdot \left(1 + z \cdot z\right)\right)}^{-1} \cdot \color{blue}{\frac{1}{x}} \]
      13. lower-*.f64N/A

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

      \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(z, z, 1\right) \cdot y\right)}^{-1} \cdot {x}^{-1}} \]
    5. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(z, z, 1\right) \cdot y\right)}^{-1}} \cdot {x}^{-1} \]
      2. lift-*.f64N/A

        \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(z, z, 1\right) \cdot y\right)}}^{-1} \cdot {x}^{-1} \]
      3. lift-fma.f64N/A

        \[\leadsto {\left(\color{blue}{\left(z \cdot z + 1\right)} \cdot y\right)}^{-1} \cdot {x}^{-1} \]
      4. sqr-powN/A

        \[\leadsto \color{blue}{\left({\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right)} \cdot {x}^{-1} \]
      5. lower-*.f64N/A

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

        \[\leadsto \left({\color{blue}{\left(y \cdot \left(z \cdot z + 1\right)\right)}}^{\left(\frac{-1}{2}\right)} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      7. pow2N/A

        \[\leadsto \left({\left(y \cdot \left(\color{blue}{{z}^{2}} + 1\right)\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      8. +-commutativeN/A

        \[\leadsto \left({\left(y \cdot \color{blue}{\left(1 + {z}^{2}\right)}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      9. pow2N/A

        \[\leadsto \left({\left(y \cdot \left(1 + \color{blue}{z \cdot z}\right)\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      10. metadata-evalN/A

        \[\leadsto \left({\left(y \cdot \left(1 + z \cdot z\right)\right)}^{\color{blue}{\frac{-1}{2}}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      11. lower-pow.f64N/A

        \[\leadsto \left(\color{blue}{{\left(y \cdot \left(1 + z \cdot z\right)\right)}^{\frac{-1}{2}}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      12. pow2N/A

        \[\leadsto \left({\left(y \cdot \left(1 + \color{blue}{{z}^{2}}\right)\right)}^{\frac{-1}{2}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      13. +-commutativeN/A

        \[\leadsto \left({\left(y \cdot \color{blue}{\left({z}^{2} + 1\right)}\right)}^{\frac{-1}{2}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      14. pow2N/A

        \[\leadsto \left({\left(y \cdot \left(\color{blue}{z \cdot z} + 1\right)\right)}^{\frac{-1}{2}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      15. *-commutativeN/A

        \[\leadsto \left({\color{blue}{\left(\left(z \cdot z + 1\right) \cdot y\right)}}^{\frac{-1}{2}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      16. lift-fma.f64N/A

        \[\leadsto \left({\left(\color{blue}{\mathsf{fma}\left(z, z, 1\right)} \cdot y\right)}^{\frac{-1}{2}} \cdot {\left(\left(z \cdot z + 1\right) \cdot y\right)}^{\left(\frac{-1}{2}\right)}\right) \cdot {x}^{-1} \]
      17. lift-*.f64N/A

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

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

    if 1.00000000000000007e260 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 78.4%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(1 + z \cdot z\right)}} \]
      2. lift-+.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(1 + z \cdot z\right)}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{z \cdot z}\right)} \]
      4. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{{z}^{2}}\right)} \]
      5. distribute-lft-inN/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot 1 + y \cdot {z}^{2}}} \]
      6. *-rgt-identityN/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y} + y \cdot {z}^{2}} \]
      7. +-commutativeN/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot {z}^{2} + y}} \]
      8. pow2N/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(z \cdot z\right)} + y} \]
      9. sqr-neg-revN/A

        \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + y} \]
      10. associate-*r*N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\left(y \cdot \left(\mathsf{neg}\left(z\right)\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)} + y} \]
      11. lower-fma.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\mathsf{fma}\left(y \cdot \left(\mathsf{neg}\left(z\right)\right), \mathsf{neg}\left(z\right), y\right)}} \]
      12. lower-*.f64N/A

        \[\leadsto \frac{\frac{1}{x}}{\mathsf{fma}\left(\color{blue}{y \cdot \left(\mathsf{neg}\left(z\right)\right)}, \mathsf{neg}\left(z\right), y\right)} \]
      13. lower-neg.f64N/A

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

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

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

      \[\leadsto \color{blue}{\frac{-1}{x \cdot \left(y \cdot \left(-1 \cdot {z}^{2} - 1\right)\right)}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

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

        \[\leadsto \frac{-1}{\left(x \cdot y\right) \cdot \color{blue}{\left(-1 \cdot {z}^{2} - 1\right)}} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{-1}{\left(x \cdot y\right) \cdot \color{blue}{\left(-1 \cdot {z}^{2} - 1\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\color{blue}{-1 \cdot {z}^{2}} - 1\right)} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\color{blue}{-1 \cdot {z}^{2}} - 1\right)} \]
      6. mul-1-negN/A

        \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\left(\mathsf{neg}\left({z}^{2}\right)\right) - 1\right)} \]
      7. lower--.f64N/A

        \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\left(\mathsf{neg}\left({z}^{2}\right)\right) - \color{blue}{1}\right)} \]
      8. lower-neg.f64N/A

        \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\left(-{z}^{2}\right) - 1\right)} \]
      9. pow2N/A

        \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\left(-z \cdot z\right) - 1\right)} \]
      10. lift-*.f6482.9

        \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\left(-z \cdot z\right) - 1\right)} \]
    7. Applied rewrites82.9%

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

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

Alternative 7: 91.5% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \frac{1}{\left(y \cdot x\right) \cdot \left(z \cdot z - -1\right)} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (/ 1.0 (* (* y x) (- (* z z) -1.0))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	return 1.0 / ((y * x) * ((z * z) - -1.0));
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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

    \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(1 + z \cdot z\right)}} \]
    2. lift-+.f64N/A

      \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(1 + z \cdot z\right)}} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{z \cdot z}\right)} \]
    4. pow2N/A

      \[\leadsto \frac{\frac{1}{x}}{y \cdot \left(1 + \color{blue}{{z}^{2}}\right)} \]
    5. distribute-lft-inN/A

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot 1 + y \cdot {z}^{2}}} \]
    6. *-rgt-identityN/A

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y} + y \cdot {z}^{2}} \]
    7. +-commutativeN/A

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot {z}^{2} + y}} \]
    8. pow2N/A

      \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(z \cdot z\right)} + y} \]
    9. sqr-neg-revN/A

      \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + y} \]
    10. associate-*r*N/A

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\left(y \cdot \left(\mathsf{neg}\left(z\right)\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)} + y} \]
    11. lower-fma.f64N/A

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\mathsf{fma}\left(y \cdot \left(\mathsf{neg}\left(z\right)\right), \mathsf{neg}\left(z\right), y\right)}} \]
    12. lower-*.f64N/A

      \[\leadsto \frac{\frac{1}{x}}{\mathsf{fma}\left(\color{blue}{y \cdot \left(\mathsf{neg}\left(z\right)\right)}, \mathsf{neg}\left(z\right), y\right)} \]
    13. lower-neg.f64N/A

      \[\leadsto \frac{\frac{1}{x}}{\mathsf{fma}\left(y \cdot \color{blue}{\left(-z\right)}, \mathsf{neg}\left(z\right), y\right)} \]
    14. lower-neg.f6495.7

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

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

    \[\leadsto \color{blue}{\frac{-1}{x \cdot \left(y \cdot \left(-1 \cdot {z}^{2} - 1\right)\right)}} \]
  6. Step-by-step derivation
    1. lower-/.f64N/A

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

      \[\leadsto \frac{-1}{\left(x \cdot y\right) \cdot \color{blue}{\left(-1 \cdot {z}^{2} - 1\right)}} \]
    3. lower-*.f64N/A

      \[\leadsto \frac{-1}{\left(x \cdot y\right) \cdot \color{blue}{\left(-1 \cdot {z}^{2} - 1\right)}} \]
    4. *-commutativeN/A

      \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\color{blue}{-1 \cdot {z}^{2}} - 1\right)} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\color{blue}{-1 \cdot {z}^{2}} - 1\right)} \]
    6. mul-1-negN/A

      \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\left(\mathsf{neg}\left({z}^{2}\right)\right) - 1\right)} \]
    7. lower--.f64N/A

      \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\left(\mathsf{neg}\left({z}^{2}\right)\right) - \color{blue}{1}\right)} \]
    8. lower-neg.f64N/A

      \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\left(-{z}^{2}\right) - 1\right)} \]
    9. pow2N/A

      \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\left(-z \cdot z\right) - 1\right)} \]
    10. lift-*.f6488.6

      \[\leadsto \frac{-1}{\left(y \cdot x\right) \cdot \left(\left(-z \cdot z\right) - 1\right)} \]
  7. Applied rewrites88.6%

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

    \[\leadsto \frac{1}{\left(y \cdot x\right) \cdot \left(z \cdot z - -1\right)} \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2025057 
(FPCore (x y z)
  :name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< (* y (+ 1 (* z z))) -inf.0) (/ (/ 1 y) (* (+ 1 (* z z)) x)) (if (< (* y (+ 1 (* z z))) 868074325056725200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (/ 1 x) (* (+ 1 (* z z)) y)) (/ (/ 1 y) (* (+ 1 (* z z)) x)))))

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