Average Error: 7.0 → 3.9
Time: 20.9s
Precision: 64
\[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -9.275971739486716 \cdot 10^{+43}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\ \mathbf{elif}\;z \le 5.440139318875033 \cdot 10^{+158}:\\ \;\;\;\;\frac{1.0 \cdot \frac{\frac{1}{x}}{z \cdot z + 1.0}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\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 \le -9.275971739486716 \cdot 10^{+43}:\\
\;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\

\mathbf{elif}\;z \le 5.440139318875033 \cdot 10^{+158}:\\
\;\;\;\;\frac{1.0 \cdot \frac{\frac{1}{x}}{z \cdot z + 1.0}}{y}\\

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

\end{array}
double f(double x, double y, double z) {
        double r6738038 = 1.0;
        double r6738039 = x;
        double r6738040 = r6738038 / r6738039;
        double r6738041 = y;
        double r6738042 = z;
        double r6738043 = r6738042 * r6738042;
        double r6738044 = r6738038 + r6738043;
        double r6738045 = r6738041 * r6738044;
        double r6738046 = r6738040 / r6738045;
        return r6738046;
}

double f(double x, double y, double z) {
        double r6738047 = z;
        double r6738048 = -9.275971739486716e+43;
        bool r6738049 = r6738047 <= r6738048;
        double r6738050 = 1.0;
        double r6738051 = x;
        double r6738052 = r6738050 / r6738051;
        double r6738053 = y;
        double r6738054 = r6738047 * r6738053;
        double r6738055 = r6738054 * r6738047;
        double r6738056 = r6738052 / r6738055;
        double r6738057 = 5.440139318875033e+158;
        bool r6738058 = r6738047 <= r6738057;
        double r6738059 = 1.0;
        double r6738060 = r6738059 / r6738051;
        double r6738061 = r6738047 * r6738047;
        double r6738062 = r6738061 + r6738050;
        double r6738063 = r6738060 / r6738062;
        double r6738064 = r6738050 * r6738063;
        double r6738065 = r6738064 / r6738053;
        double r6738066 = r6738058 ? r6738065 : r6738056;
        double r6738067 = r6738049 ? r6738056 : r6738066;
        return r6738067;
}

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

Original7.0
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 < -9.275971739486716e+43 or 5.440139318875033e+158 < z

    1. Initial program 16.3

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

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

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

    if -9.275971739486716e+43 < z < 5.440139318875033e+158

    1. Initial program 1.7

      \[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]
    2. Using strategy rm
    3. Applied div-inv1.7

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

      \[\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.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -9.275971739486716 \cdot 10^{+43}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\ \mathbf{elif}\;z \le 5.440139318875033 \cdot 10^{+158}:\\ \;\;\;\;\frac{1.0 \cdot \frac{\frac{1}{x}}{z \cdot z + 1.0}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\ \end{array}\]

Reproduce

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