Average Error: 6.5 → 2.6
Time: 12.1s
Precision: 64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{x} \le -2.002218201762429993701392298517075265989 \cdot 10^{95}:\\ \;\;\;\;\frac{1}{y \cdot \left(\left(z \cdot x\right) \cdot z + 1 \cdot x\right)}\\ \mathbf{elif}\;\frac{1}{x} \le 5.035018908840506177177784115752137106762 \cdot 10^{-32}:\\ \;\;\;\;\frac{\frac{1}{\left(z \cdot z + 1\right) \cdot y}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y \cdot \left(\left(z \cdot x\right) \cdot z + 1 \cdot x\right)}\\ \end{array}\]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;\frac{1}{x} \le -2.002218201762429993701392298517075265989 \cdot 10^{95}:\\
\;\;\;\;\frac{1}{y \cdot \left(\left(z \cdot x\right) \cdot z + 1 \cdot x\right)}\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r14608514 = 1.0;
        double r14608515 = x;
        double r14608516 = r14608514 / r14608515;
        double r14608517 = y;
        double r14608518 = z;
        double r14608519 = r14608518 * r14608518;
        double r14608520 = r14608514 + r14608519;
        double r14608521 = r14608517 * r14608520;
        double r14608522 = r14608516 / r14608521;
        return r14608522;
}

double f(double x, double y, double z) {
        double r14608523 = 1.0;
        double r14608524 = x;
        double r14608525 = r14608523 / r14608524;
        double r14608526 = -2.00221820176243e+95;
        bool r14608527 = r14608525 <= r14608526;
        double r14608528 = y;
        double r14608529 = z;
        double r14608530 = r14608529 * r14608524;
        double r14608531 = r14608530 * r14608529;
        double r14608532 = r14608523 * r14608524;
        double r14608533 = r14608531 + r14608532;
        double r14608534 = r14608528 * r14608533;
        double r14608535 = r14608523 / r14608534;
        double r14608536 = 5.035018908840506e-32;
        bool r14608537 = r14608525 <= r14608536;
        double r14608538 = r14608529 * r14608529;
        double r14608539 = r14608538 + r14608523;
        double r14608540 = r14608539 * r14608528;
        double r14608541 = r14608523 / r14608540;
        double r14608542 = r14608541 / r14608524;
        double r14608543 = r14608537 ? r14608542 : r14608535;
        double r14608544 = r14608527 ? r14608535 : r14608543;
        return r14608544;
}

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.5
Target5.7
Herbie2.6
\[\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) < -2.00221820176243e+95 or 5.035018908840506e-32 < (/ 1.0 x)

    1. Initial program 12.7

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

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{{z}^{2} \cdot y + 1 \cdot y}}\]
    3. Simplified12.7

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(z \cdot z + 1\right)}}\]
    4. Using strategy rm
    5. Applied associate-/l/12.7

      \[\leadsto \color{blue}{\frac{1}{\left(y \cdot \left(z \cdot z + 1\right)\right) \cdot x}}\]
    6. Taylor expanded around inf 12.7

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

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

    if -2.00221820176243e+95 < (/ 1.0 x) < 5.035018908840506e-32

    1. Initial program 2.1

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

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{{z}^{2} \cdot y + 1 \cdot y}}\]
    3. Simplified2.1

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(z \cdot z + 1\right)}}\]
    4. Using strategy rm
    5. Applied associate-/l/2.3

      \[\leadsto \color{blue}{\frac{1}{\left(y \cdot \left(z \cdot z + 1\right)\right) \cdot x}}\]
    6. Using strategy rm
    7. Applied associate-/r*2.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{x} \le -2.002218201762429993701392298517075265989 \cdot 10^{95}:\\ \;\;\;\;\frac{1}{y \cdot \left(\left(z \cdot x\right) \cdot z + 1 \cdot x\right)}\\ \mathbf{elif}\;\frac{1}{x} \le 5.035018908840506177177784115752137106762 \cdot 10^{-32}:\\ \;\;\;\;\frac{\frac{1}{\left(z \cdot z + 1\right) \cdot y}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y \cdot \left(\left(z \cdot x\right) \cdot z + 1 \cdot x\right)}\\ \end{array}\]

Reproduce

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