Average Error: 6.4 → 3.8
Time: 12.4s
Precision: 64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -87792697.949794352054595947265625:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z}\\ \mathbf{elif}\;z \le 43830190522330763379080355395928064:\\ \;\;\;\;\frac{1}{\left(y \cdot x\right) \cdot \left(1 + z \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z}\\ \end{array}\]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;z \le -87792697.949794352054595947265625:\\
\;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z}\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r16827642 = 1.0;
        double r16827643 = x;
        double r16827644 = r16827642 / r16827643;
        double r16827645 = y;
        double r16827646 = z;
        double r16827647 = r16827646 * r16827646;
        double r16827648 = r16827642 + r16827647;
        double r16827649 = r16827645 * r16827648;
        double r16827650 = r16827644 / r16827649;
        return r16827650;
}

double f(double x, double y, double z) {
        double r16827651 = z;
        double r16827652 = -87792697.94979435;
        bool r16827653 = r16827651 <= r16827652;
        double r16827654 = 1.0;
        double r16827655 = x;
        double r16827656 = r16827654 / r16827655;
        double r16827657 = y;
        double r16827658 = r16827651 * r16827657;
        double r16827659 = r16827658 * r16827651;
        double r16827660 = r16827656 / r16827659;
        double r16827661 = 4.383019052233076e+34;
        bool r16827662 = r16827651 <= r16827661;
        double r16827663 = r16827657 * r16827655;
        double r16827664 = r16827651 * r16827651;
        double r16827665 = r16827654 + r16827664;
        double r16827666 = r16827663 * r16827665;
        double r16827667 = r16827654 / r16827666;
        double r16827668 = r16827662 ? r16827667 : r16827660;
        double r16827669 = r16827653 ? r16827660 : r16827668;
        return r16827669;
}

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.4
Target5.7
Herbie3.8
\[\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 z < -87792697.94979435 or 4.383019052233076e+34 < z

    1. Initial program 12.5

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

      \[\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*12.5

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\left(y \cdot \sqrt{1 + z \cdot z}\right) \cdot \sqrt{1 + z \cdot z}}}\]
    5. Using strategy rm
    6. Applied div-inv12.5

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{1}{\left(y \cdot \sqrt{1 + z \cdot z}\right) \cdot \sqrt{1 + z \cdot z}}}\]
    7. Simplified12.4

      \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{\frac{1}{y}}{1 + z \cdot z}}\]
    8. Taylor expanded around inf 12.7

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

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

    if -87792697.94979435 < z < 4.383019052233076e+34

    1. Initial program 0.4

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

      \[\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*0.4

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\left(y \cdot \sqrt{1 + z \cdot z}\right) \cdot \sqrt{1 + z \cdot z}}}\]
    5. Using strategy rm
    6. Applied div-inv0.4

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{1}{x}}}{\left(y \cdot \sqrt{1 + z \cdot z}\right) \cdot \sqrt{1 + z \cdot z}}\]
    7. Applied associate-/l*0.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -87792697.949794352054595947265625:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z}\\ \mathbf{elif}\;z \le 43830190522330763379080355395928064:\\ \;\;\;\;\frac{1}{\left(y \cdot x\right) \cdot \left(1 + z \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z}\\ \end{array}\]

Reproduce

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