Average Error: 6.7 → 3.9
Time: 58.8s
Precision: 64
\[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3217085146405912.5:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\ \mathbf{elif}\;z \le 1.1441839465342135 \cdot 10^{+118}:\\ \;\;\;\;\frac{\frac{\frac{\frac{1.0}{x}}{y}}{\sqrt{1.0 + z \cdot z}}}{\sqrt{1.0 + z \cdot z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\ \end{array}\]
\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;z \le -3217085146405912.5:\\
\;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\

\mathbf{elif}\;z \le 1.1441839465342135 \cdot 10^{+118}:\\
\;\;\;\;\frac{\frac{\frac{\frac{1.0}{x}}{y}}{\sqrt{1.0 + z \cdot z}}}{\sqrt{1.0 + z \cdot z}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r18700422 = 1.0;
        double r18700423 = x;
        double r18700424 = r18700422 / r18700423;
        double r18700425 = y;
        double r18700426 = z;
        double r18700427 = r18700426 * r18700426;
        double r18700428 = r18700422 + r18700427;
        double r18700429 = r18700425 * r18700428;
        double r18700430 = r18700424 / r18700429;
        return r18700430;
}

double f(double x, double y, double z) {
        double r18700431 = z;
        double r18700432 = -3217085146405912.5;
        bool r18700433 = r18700431 <= r18700432;
        double r18700434 = 1.0;
        double r18700435 = x;
        double r18700436 = r18700434 / r18700435;
        double r18700437 = y;
        double r18700438 = r18700431 * r18700437;
        double r18700439 = r18700438 * r18700431;
        double r18700440 = r18700436 / r18700439;
        double r18700441 = 1.1441839465342135e+118;
        bool r18700442 = r18700431 <= r18700441;
        double r18700443 = r18700436 / r18700437;
        double r18700444 = r18700431 * r18700431;
        double r18700445 = r18700434 + r18700444;
        double r18700446 = sqrt(r18700445);
        double r18700447 = r18700443 / r18700446;
        double r18700448 = r18700447 / r18700446;
        double r18700449 = r18700442 ? r18700448 : r18700440;
        double r18700450 = r18700433 ? r18700440 : r18700449;
        return r18700450;
}

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.7
Target5.9
Herbie3.9
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(1.0 + z \cdot z\right) \lt -\infty:\\ \;\;\;\;\frac{\frac{1.0}{y}}{\left(1.0 + z \cdot z\right) \cdot x}\\ \mathbf{elif}\;y \cdot \left(1.0 + z \cdot z\right) \lt 8.680743250567252 \cdot 10^{+305}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(1.0 + z \cdot z\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1.0}{y}}{\left(1.0 + z \cdot z\right) \cdot x}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -3217085146405912.5 or 1.1441839465342135e+118 < z

    1. Initial program 14.2

      \[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]
    2. Taylor expanded around inf 14.3

      \[\leadsto \color{blue}{\frac{1.0}{x \cdot \left({z}^{2} \cdot y\right)}}\]
    3. Simplified7.6

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

    if -3217085146405912.5 < z < 1.1441839465342135e+118

    1. Initial program 1.2

      \[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]
    2. Using strategy rm
    3. Applied associate-/r*1.1

      \[\leadsto \color{blue}{\frac{\frac{\frac{1.0}{x}}{y}}{1.0 + z \cdot z}}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt1.1

      \[\leadsto \frac{\frac{\frac{1.0}{x}}{y}}{\color{blue}{\sqrt{1.0 + z \cdot z} \cdot \sqrt{1.0 + z \cdot z}}}\]
    6. Applied associate-/r*1.1

      \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{1.0}{x}}{y}}{\sqrt{1.0 + z \cdot z}}}{\sqrt{1.0 + z \cdot z}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3217085146405912.5:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\ \mathbf{elif}\;z \le 1.1441839465342135 \cdot 10^{+118}:\\ \;\;\;\;\frac{\frac{\frac{\frac{1.0}{x}}{y}}{\sqrt{1.0 + z \cdot z}}}{\sqrt{1.0 + z \cdot z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019162 
(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)))))