Average Error: 6.5 → 1.9
Time: 44.0s
Precision: 64
\[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;\left(1.0 + z \cdot z\right) \cdot y = -\infty:\\ \;\;\;\;\left(\frac{1.0}{z \cdot x} \cdot \frac{\sqrt[3]{-1} \cdot \sqrt[3]{\frac{-1}{y}}}{z}\right) \cdot \left(\sqrt[3]{\frac{1}{y}} \cdot \sqrt[3]{\frac{1}{y}}\right)\\ \mathbf{elif}\;\left(1.0 + z \cdot z\right) \cdot y \le 7.715242497005938 \cdot 10^{+300}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(\left(\sqrt[3]{\sqrt{1.0 + z \cdot z}} \cdot \sqrt[3]{\sqrt{1.0 + z \cdot z}}\right) \cdot \sqrt[3]{\sqrt{1.0 + z \cdot z}}\right) \cdot \left(y \cdot \sqrt{1.0 + z \cdot z}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1.0}{z \cdot x} \cdot \frac{\sqrt[3]{-1} \cdot \sqrt[3]{\frac{-1}{y}}}{z}\right) \cdot \left(\sqrt[3]{\frac{1}{y}} \cdot \sqrt[3]{\frac{1}{y}}\right)\\ \end{array}\]
\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;\left(1.0 + z \cdot z\right) \cdot y = -\infty:\\
\;\;\;\;\left(\frac{1.0}{z \cdot x} \cdot \frac{\sqrt[3]{-1} \cdot \sqrt[3]{\frac{-1}{y}}}{z}\right) \cdot \left(\sqrt[3]{\frac{1}{y}} \cdot \sqrt[3]{\frac{1}{y}}\right)\\

\mathbf{elif}\;\left(1.0 + z \cdot z\right) \cdot y \le 7.715242497005938 \cdot 10^{+300}:\\
\;\;\;\;\frac{\frac{1.0}{x}}{\left(\left(\sqrt[3]{\sqrt{1.0 + z \cdot z}} \cdot \sqrt[3]{\sqrt{1.0 + z \cdot z}}\right) \cdot \sqrt[3]{\sqrt{1.0 + z \cdot z}}\right) \cdot \left(y \cdot \sqrt{1.0 + z \cdot z}\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{1.0}{z \cdot x} \cdot \frac{\sqrt[3]{-1} \cdot \sqrt[3]{\frac{-1}{y}}}{z}\right) \cdot \left(\sqrt[3]{\frac{1}{y}} \cdot \sqrt[3]{\frac{1}{y}}\right)\\

\end{array}
double f(double x, double y, double z) {
        double r18535711 = 1.0;
        double r18535712 = x;
        double r18535713 = r18535711 / r18535712;
        double r18535714 = y;
        double r18535715 = z;
        double r18535716 = r18535715 * r18535715;
        double r18535717 = r18535711 + r18535716;
        double r18535718 = r18535714 * r18535717;
        double r18535719 = r18535713 / r18535718;
        return r18535719;
}

double f(double x, double y, double z) {
        double r18535720 = 1.0;
        double r18535721 = z;
        double r18535722 = r18535721 * r18535721;
        double r18535723 = r18535720 + r18535722;
        double r18535724 = y;
        double r18535725 = r18535723 * r18535724;
        double r18535726 = -inf.0;
        bool r18535727 = r18535725 <= r18535726;
        double r18535728 = x;
        double r18535729 = r18535721 * r18535728;
        double r18535730 = r18535720 / r18535729;
        double r18535731 = -1.0;
        double r18535732 = cbrt(r18535731);
        double r18535733 = r18535731 / r18535724;
        double r18535734 = cbrt(r18535733);
        double r18535735 = r18535732 * r18535734;
        double r18535736 = r18535735 / r18535721;
        double r18535737 = r18535730 * r18535736;
        double r18535738 = 1.0;
        double r18535739 = r18535738 / r18535724;
        double r18535740 = cbrt(r18535739);
        double r18535741 = r18535740 * r18535740;
        double r18535742 = r18535737 * r18535741;
        double r18535743 = 7.715242497005938e+300;
        bool r18535744 = r18535725 <= r18535743;
        double r18535745 = r18535720 / r18535728;
        double r18535746 = sqrt(r18535723);
        double r18535747 = cbrt(r18535746);
        double r18535748 = r18535747 * r18535747;
        double r18535749 = r18535748 * r18535747;
        double r18535750 = r18535724 * r18535746;
        double r18535751 = r18535749 * r18535750;
        double r18535752 = r18535745 / r18535751;
        double r18535753 = r18535744 ? r18535752 : r18535742;
        double r18535754 = r18535727 ? r18535742 : r18535753;
        return r18535754;
}

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.5
Target5.9
Herbie1.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 (* y (+ 1.0 (* z z))) < -inf.0 or 7.715242497005938e+300 < (* y (+ 1.0 (* z z)))

    1. Initial program 18.4

      \[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity18.4

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y}} \cdot \frac{\frac{1.0}{x}}{1.0 + z \cdot z}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt14.9

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{\frac{1}{y}} \cdot \sqrt[3]{\frac{1}{y}}\right) \cdot \sqrt[3]{\frac{1}{y}}\right)} \cdot \frac{\frac{1.0}{x}}{1.0 + z \cdot z}\]
    10. Applied associate-*l*14.9

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{1}{y}} \cdot \sqrt[3]{\frac{1}{y}}\right) \cdot \left(\sqrt[3]{\frac{1}{y}} \cdot \frac{\frac{1.0}{x}}{1.0 + z \cdot z}\right)}\]
    11. Taylor expanded around -inf 39.7

      \[\leadsto \left(\sqrt[3]{\frac{1}{y}} \cdot \sqrt[3]{\frac{1}{y}}\right) \cdot \color{blue}{\left(1.0 \cdot \left(\frac{\sqrt[3]{-1}}{x \cdot {z}^{2}} \cdot {\left(\frac{-1}{y}\right)}^{\frac{1}{3}}\right)\right)}\]
    12. Simplified4.6

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

    if -inf.0 < (* y (+ 1.0 (* z z))) < 7.715242497005938e+300

    1. Initial program 0.3

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

      \[\leadsto \frac{\frac{1.0}{x}}{y \cdot \color{blue}{\left(\sqrt{1.0 + z \cdot z} \cdot \sqrt{1.0 + z \cdot z}\right)}}\]
    4. Applied associate-*r*0.3

      \[\leadsto \frac{\frac{1.0}{x}}{\color{blue}{\left(y \cdot \sqrt{1.0 + z \cdot z}\right) \cdot \sqrt{1.0 + z \cdot z}}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt0.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(1.0 + z \cdot z\right) \cdot y = -\infty:\\ \;\;\;\;\left(\frac{1.0}{z \cdot x} \cdot \frac{\sqrt[3]{-1} \cdot \sqrt[3]{\frac{-1}{y}}}{z}\right) \cdot \left(\sqrt[3]{\frac{1}{y}} \cdot \sqrt[3]{\frac{1}{y}}\right)\\ \mathbf{elif}\;\left(1.0 + z \cdot z\right) \cdot y \le 7.715242497005938 \cdot 10^{+300}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(\left(\sqrt[3]{\sqrt{1.0 + z \cdot z}} \cdot \sqrt[3]{\sqrt{1.0 + z \cdot z}}\right) \cdot \sqrt[3]{\sqrt{1.0 + z \cdot z}}\right) \cdot \left(y \cdot \sqrt{1.0 + z \cdot z}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1.0}{z \cdot x} \cdot \frac{\sqrt[3]{-1} \cdot \sqrt[3]{\frac{-1}{y}}}{z}\right) \cdot \left(\sqrt[3]{\frac{1}{y}} \cdot \sqrt[3]{\frac{1}{y}}\right)\\ \end{array}\]

Reproduce

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