Average Error: 6.9 → 3.9
Time: 48.6s
Precision: 64
\[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot z \le 1.3636091202374743 \cdot 10^{+164}:\\ \;\;\;\;\frac{\frac{\frac{1.0}{z \cdot z + 1.0}}{x}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(y \cdot z\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 \cdot z \le 1.3636091202374743 \cdot 10^{+164}:\\
\;\;\;\;\frac{\frac{\frac{1.0}{z \cdot z + 1.0}}{x}}{y}\\

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

\end{array}
double f(double x, double y, double z) {
        double r18034319 = 1.0;
        double r18034320 = x;
        double r18034321 = r18034319 / r18034320;
        double r18034322 = y;
        double r18034323 = z;
        double r18034324 = r18034323 * r18034323;
        double r18034325 = r18034319 + r18034324;
        double r18034326 = r18034322 * r18034325;
        double r18034327 = r18034321 / r18034326;
        return r18034327;
}

double f(double x, double y, double z) {
        double r18034328 = z;
        double r18034329 = r18034328 * r18034328;
        double r18034330 = 1.3636091202374743e+164;
        bool r18034331 = r18034329 <= r18034330;
        double r18034332 = 1.0;
        double r18034333 = r18034329 + r18034332;
        double r18034334 = r18034332 / r18034333;
        double r18034335 = x;
        double r18034336 = r18034334 / r18034335;
        double r18034337 = y;
        double r18034338 = r18034336 / r18034337;
        double r18034339 = r18034332 / r18034335;
        double r18034340 = r18034337 * r18034328;
        double r18034341 = r18034340 * r18034328;
        double r18034342 = r18034339 / r18034341;
        double r18034343 = r18034331 ? r18034338 : r18034342;
        return r18034343;
}

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.9
Target6.2
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 z) < 1.3636091202374743e+164

    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 div-inv1.2

      \[\leadsto \frac{\color{blue}{1.0 \cdot \frac{1}{x}}}{y \cdot \left(1.0 + z \cdot z\right)}\]
    4. Applied times-frac1.1

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{\frac{1.0}{1.0 + z \cdot z}}{x}}}{y}\]

    if 1.3636091202374743e+164 < (* z z)

    1. Initial program 15.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \le 1.3636091202374743 \cdot 10^{+164}:\\ \;\;\;\;\frac{\frac{\frac{1.0}{z \cdot z + 1.0}}{x}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(y \cdot z\right) \cdot z}\\ \end{array}\]

Reproduce

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