Average Error: 6.5 → 1.6
Time: 10.1s
Precision: 64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.063324637959538229342771347897190184734 \cdot 10^{-99}:\\ \;\;\;\;\frac{1}{x \cdot \left(1 \cdot y + \left(z \cdot y\right) \cdot z\right)}\\ \mathbf{elif}\;x \le 7.55716549245786398018609449977741732329 \cdot 10^{-59}:\\ \;\;\;\;\frac{1}{y \cdot \left(\left(x \cdot z\right) \cdot z + 1 \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{1 \cdot y + \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}\;x \le -3.063324637959538229342771347897190184734 \cdot 10^{-99}:\\
\;\;\;\;\frac{1}{x \cdot \left(1 \cdot y + \left(z \cdot y\right) \cdot z\right)}\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r183038 = 1.0;
        double r183039 = x;
        double r183040 = r183038 / r183039;
        double r183041 = y;
        double r183042 = z;
        double r183043 = r183042 * r183042;
        double r183044 = r183038 + r183043;
        double r183045 = r183041 * r183044;
        double r183046 = r183040 / r183045;
        return r183046;
}

double f(double x, double y, double z) {
        double r183047 = x;
        double r183048 = -3.0633246379595382e-99;
        bool r183049 = r183047 <= r183048;
        double r183050 = 1.0;
        double r183051 = y;
        double r183052 = r183050 * r183051;
        double r183053 = z;
        double r183054 = r183053 * r183051;
        double r183055 = r183054 * r183053;
        double r183056 = r183052 + r183055;
        double r183057 = r183047 * r183056;
        double r183058 = r183050 / r183057;
        double r183059 = 7.557165492457864e-59;
        bool r183060 = r183047 <= r183059;
        double r183061 = r183047 * r183053;
        double r183062 = r183061 * r183053;
        double r183063 = r183050 * r183047;
        double r183064 = r183062 + r183063;
        double r183065 = r183051 * r183064;
        double r183066 = r183050 / r183065;
        double r183067 = r183050 / r183047;
        double r183068 = r183067 / r183056;
        double r183069 = r183060 ? r183066 : r183068;
        double r183070 = r183049 ? r183058 : r183069;
        return r183070;
}

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
Herbie1.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 3 regimes
  2. if x < -3.0633246379595382e-99

    1. Initial program 2.6

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{x}}{z \cdot \left(z \cdot y\right) + \color{blue}{1 \cdot y}}\]
    8. Using strategy rm
    9. Applied div-inv1.0

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

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

      \[\leadsto \frac{1}{\color{blue}{\left(y \cdot \left(1 + z \cdot z\right)\right) \cdot x}}\]
    12. Using strategy rm
    13. Applied distribute-lft-in2.8

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

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

    if -3.0633246379595382e-99 < x < 7.557165492457864e-59

    1. Initial program 14.4

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

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

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(z \cdot z + 1\right)}}\]
    4. Using strategy rm
    5. Applied distribute-lft-in14.4

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

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

      \[\leadsto \frac{\frac{1}{x}}{z \cdot \left(z \cdot y\right) + \color{blue}{1 \cdot y}}\]
    8. Using strategy rm
    9. Applied div-inv10.0

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

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

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

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

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

    if 7.557165492457864e-59 < x

    1. Initial program 2.4

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

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

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{y \cdot \left(z \cdot z + 1\right)}}\]
    4. Using strategy rm
    5. Applied distribute-lft-in2.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -3.063324637959538229342771347897190184734 \cdot 10^{-99}:\\ \;\;\;\;\frac{1}{x \cdot \left(1 \cdot y + \left(z \cdot y\right) \cdot z\right)}\\ \mathbf{elif}\;x \le 7.55716549245786398018609449977741732329 \cdot 10^{-59}:\\ \;\;\;\;\frac{1}{y \cdot \left(\left(x \cdot z\right) \cdot z + 1 \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{1 \cdot y + \left(z \cdot y\right) \cdot z}\\ \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)))))