Average Error: 6.6 → 5.3
Time: 3.6m
Precision: 64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{x} \le -1.036913385199169391055906928293174911194 \cdot 10^{-54}:\\ \;\;\;\;\frac{\frac{1}{\left(1 + z \cdot z\right) \cdot x}}{y}\\ \mathbf{elif}\;\frac{1}{x} \le 7.822280617657175454529483218136414090897 \cdot 10^{-45}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(y \cdot \sqrt{1 + z \cdot z}\right) \cdot \sqrt{1 + z \cdot z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\left(1 + z \cdot z\right) \cdot x}}{y}\\ \end{array}\]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;\frac{1}{x} \le -1.036913385199169391055906928293174911194 \cdot 10^{-54}:\\
\;\;\;\;\frac{\frac{1}{\left(1 + z \cdot z\right) \cdot x}}{y}\\

\mathbf{elif}\;\frac{1}{x} \le 7.822280617657175454529483218136414090897 \cdot 10^{-45}:\\
\;\;\;\;\frac{\frac{1}{x}}{\left(y \cdot \sqrt{1 + z \cdot z}\right) \cdot \sqrt{1 + z \cdot z}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r154426414 = 1.0;
        double r154426415 = x;
        double r154426416 = r154426414 / r154426415;
        double r154426417 = y;
        double r154426418 = z;
        double r154426419 = r154426418 * r154426418;
        double r154426420 = r154426414 + r154426419;
        double r154426421 = r154426417 * r154426420;
        double r154426422 = r154426416 / r154426421;
        return r154426422;
}

double f(double x, double y, double z) {
        double r154426423 = 1.0;
        double r154426424 = x;
        double r154426425 = r154426423 / r154426424;
        double r154426426 = -1.0369133851991694e-54;
        bool r154426427 = r154426425 <= r154426426;
        double r154426428 = z;
        double r154426429 = r154426428 * r154426428;
        double r154426430 = r154426423 + r154426429;
        double r154426431 = r154426430 * r154426424;
        double r154426432 = r154426423 / r154426431;
        double r154426433 = y;
        double r154426434 = r154426432 / r154426433;
        double r154426435 = 7.822280617657175e-45;
        bool r154426436 = r154426425 <= r154426435;
        double r154426437 = sqrt(r154426430);
        double r154426438 = r154426433 * r154426437;
        double r154426439 = r154426438 * r154426437;
        double r154426440 = r154426425 / r154426439;
        double r154426441 = r154426436 ? r154426440 : r154426434;
        double r154426442 = r154426427 ? r154426434 : r154426441;
        return r154426442;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.6
Target6.0
Herbie5.3
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \lt -\infty:\\ \;\;\;\;\frac{\frac{1}{y}}{\left(1 + z \cdot z\right) \cdot x}\\ \mathbf{elif}\;y \cdot \left(1 + z \cdot z\right) \lt 8.680743250567251617010582226806563373013 \cdot 10^{305}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(1 + z \cdot z\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y}}{\left(1 + z \cdot z\right) \cdot x}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ 1.0 x) < -1.0369133851991694e-54 or 7.822280617657175e-45 < (/ 1.0 x)

    1. Initial program 11.2

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity11.2

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y}} \cdot \frac{\frac{1}{x}}{1 + z \cdot z}\]
    8. Using strategy rm
    9. Applied associate-*l/8.8

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{\frac{1}{x}}{1 + z \cdot z}}{y}}\]
    10. Simplified8.8

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

    if -1.0369133851991694e-54 < (/ 1.0 x) < 7.822280617657175e-45

    1. Initial program 1.1

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt1.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{x} \le -1.036913385199169391055906928293174911194 \cdot 10^{-54}:\\ \;\;\;\;\frac{\frac{1}{\left(1 + z \cdot z\right) \cdot x}}{y}\\ \mathbf{elif}\;\frac{1}{x} \le 7.822280617657175454529483218136414090897 \cdot 10^{-45}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(y \cdot \sqrt{1 + z \cdot z}\right) \cdot \sqrt{1 + z \cdot z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\left(1 + z \cdot z\right) \cdot x}}{y}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< (* y (+ 1.0 (* z z))) -inf.0) (/ (/ 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)))))