Average Error: 6.6 → 3.7
Time: 10.6s
Precision: 64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.411471343772481365820428608937649488066 \cdot 10^{99} \lor \neg \left(z \le 2.632085656963840114023085817973933614694 \cdot 10^{102}\right):\\ \;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z} - \frac{\frac{1}{x}}{{z}^{4} \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 \cdot \frac{1}{y}}{\left(z \cdot z + 1\right) \cdot x}\\ \end{array}\]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;z \le -1.411471343772481365820428608937649488066 \cdot 10^{99} \lor \neg \left(z \le 2.632085656963840114023085817973933614694 \cdot 10^{102}\right):\\
\;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z} - \frac{\frac{1}{x}}{{z}^{4} \cdot y}\\

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

\end{array}
double f(double x, double y, double z) {
        double r264613 = 1.0;
        double r264614 = x;
        double r264615 = r264613 / r264614;
        double r264616 = y;
        double r264617 = z;
        double r264618 = r264617 * r264617;
        double r264619 = r264613 + r264618;
        double r264620 = r264616 * r264619;
        double r264621 = r264615 / r264620;
        return r264621;
}

double f(double x, double y, double z) {
        double r264622 = z;
        double r264623 = -1.4114713437724814e+99;
        bool r264624 = r264622 <= r264623;
        double r264625 = 2.63208565696384e+102;
        bool r264626 = r264622 <= r264625;
        double r264627 = !r264626;
        bool r264628 = r264624 || r264627;
        double r264629 = 1.0;
        double r264630 = x;
        double r264631 = r264629 / r264630;
        double r264632 = y;
        double r264633 = r264622 * r264632;
        double r264634 = r264633 * r264622;
        double r264635 = r264631 / r264634;
        double r264636 = 4.0;
        double r264637 = pow(r264622, r264636);
        double r264638 = r264637 * r264632;
        double r264639 = r264631 / r264638;
        double r264640 = r264635 - r264639;
        double r264641 = 1.0;
        double r264642 = r264641 / r264632;
        double r264643 = r264629 * r264642;
        double r264644 = r264622 * r264622;
        double r264645 = r264644 + r264629;
        double r264646 = r264645 * r264630;
        double r264647 = r264643 / r264646;
        double r264648 = r264628 ? r264640 : r264647;
        return r264648;
}

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.6
Target5.9
Herbie3.7
\[\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 < -1.4114713437724814e+99 or 2.63208565696384e+102 < z

    1. Initial program 15.6

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

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

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

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

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

    if -1.4114713437724814e+99 < z < 2.63208565696384e+102

    1. Initial program 1.5

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
    2. Using strategy rm
    3. Applied clear-num1.9

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.411471343772481365820428608937649488066 \cdot 10^{99} \lor \neg \left(z \le 2.632085656963840114023085817973933614694 \cdot 10^{102}\right):\\ \;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z} - \frac{\frac{1}{x}}{{z}^{4} \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 \cdot \frac{1}{y}}{\left(z \cdot z + 1\right) \cdot x}\\ \end{array}\]

Reproduce

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