Average Error: 5.9 → 3.3
Time: 48.7s
Precision: 64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot z \le 6.976427399326383846312386798649046258147 \cdot 10^{286}:\\ \;\;\;\;\frac{\frac{\frac{1}{x}}{y}}{z \cdot z + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(y \cdot z\right) \cdot z}\\ \end{array}\]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;z \cdot z \le 6.976427399326383846312386798649046258147 \cdot 10^{286}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{y}}{z \cdot z + 1}\\

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

\end{array}
double f(double x, double y, double z) {
        double r13606334 = 1.0;
        double r13606335 = x;
        double r13606336 = r13606334 / r13606335;
        double r13606337 = y;
        double r13606338 = z;
        double r13606339 = r13606338 * r13606338;
        double r13606340 = r13606334 + r13606339;
        double r13606341 = r13606337 * r13606340;
        double r13606342 = r13606336 / r13606341;
        return r13606342;
}

double f(double x, double y, double z) {
        double r13606343 = z;
        double r13606344 = r13606343 * r13606343;
        double r13606345 = 6.976427399326384e+286;
        bool r13606346 = r13606344 <= r13606345;
        double r13606347 = 1.0;
        double r13606348 = x;
        double r13606349 = r13606347 / r13606348;
        double r13606350 = y;
        double r13606351 = r13606349 / r13606350;
        double r13606352 = r13606344 + r13606347;
        double r13606353 = r13606351 / r13606352;
        double r13606354 = r13606350 * r13606343;
        double r13606355 = r13606354 * r13606343;
        double r13606356 = r13606349 / r13606355;
        double r13606357 = r13606346 ? r13606353 : r13606356;
        return r13606357;
}

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

Original5.9
Target5.3
Herbie3.3
\[\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 z) < 6.976427399326384e+286

    1. Initial program 1.8

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

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

    if 6.976427399326384e+286 < (* z z)

    1. Initial program 16.1

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

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

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

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

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

Reproduce

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