Average Error: 6.7 → 3.9
Time: 57.8s
Precision: 64
\[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3217085146405912.5:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\ \mathbf{elif}\;z \le 1.1441839465342135 \cdot 10^{+118}:\\ \;\;\;\;\frac{\frac{\frac{\frac{1.0}{x}}{y}}{\sqrt{1.0 + z \cdot z}}}{\sqrt{1.0 + z \cdot z}}\\ \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 -3217085146405912.5:\\
\;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\

\mathbf{elif}\;z \le 1.1441839465342135 \cdot 10^{+118}:\\
\;\;\;\;\frac{\frac{\frac{\frac{1.0}{x}}{y}}{\sqrt{1.0 + z \cdot z}}}{\sqrt{1.0 + z \cdot z}}\\

\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 r14664201 = 1.0;
        double r14664202 = x;
        double r14664203 = r14664201 / r14664202;
        double r14664204 = y;
        double r14664205 = z;
        double r14664206 = r14664205 * r14664205;
        double r14664207 = r14664201 + r14664206;
        double r14664208 = r14664204 * r14664207;
        double r14664209 = r14664203 / r14664208;
        return r14664209;
}

double f(double x, double y, double z) {
        double r14664210 = z;
        double r14664211 = -3217085146405912.5;
        bool r14664212 = r14664210 <= r14664211;
        double r14664213 = 1.0;
        double r14664214 = x;
        double r14664215 = r14664213 / r14664214;
        double r14664216 = y;
        double r14664217 = r14664210 * r14664216;
        double r14664218 = r14664217 * r14664210;
        double r14664219 = r14664215 / r14664218;
        double r14664220 = 1.1441839465342135e+118;
        bool r14664221 = r14664210 <= r14664220;
        double r14664222 = r14664215 / r14664216;
        double r14664223 = r14664210 * r14664210;
        double r14664224 = r14664213 + r14664223;
        double r14664225 = sqrt(r14664224);
        double r14664226 = r14664222 / r14664225;
        double r14664227 = r14664226 / r14664225;
        double r14664228 = r14664221 ? r14664227 : r14664219;
        double r14664229 = r14664212 ? r14664219 : r14664228;
        return r14664229;
}

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.7
Target5.9
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 < -3217085146405912.5 or 1.1441839465342135e+118 < z

    1. Initial program 14.2

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

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

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

    if -3217085146405912.5 < z < 1.1441839465342135e+118

    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 associate-/r*1.1

      \[\leadsto \color{blue}{\frac{\frac{\frac{1.0}{x}}{y}}{1.0 + z \cdot z}}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt1.1

      \[\leadsto \frac{\frac{\frac{1.0}{x}}{y}}{\color{blue}{\sqrt{1.0 + z \cdot z} \cdot \sqrt{1.0 + z \cdot z}}}\]
    6. Applied associate-/r*1.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3217085146405912.5:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\ \mathbf{elif}\;z \le 1.1441839465342135 \cdot 10^{+118}:\\ \;\;\;\;\frac{\frac{\frac{\frac{1.0}{x}}{y}}{\sqrt{1.0 + z \cdot z}}}{\sqrt{1.0 + z \cdot z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(z \cdot y\right) \cdot z}\\ \end{array}\]

Reproduce

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