Average Error: 6.5 → 2.5
Time: 46.4s
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(\sqrt[3]{1.0} \cdot \sqrt[3]{1.0}\right) \cdot \left(\frac{\sqrt[3]{1.0}}{z \cdot \left(z \cdot \left(x \cdot y\right)\right)} - \frac{\sqrt[3]{1.0} \cdot 1.0}{\left(z \cdot \left(z \cdot \left(x \cdot y\right)\right)\right) \cdot \left(z \cdot z\right)}\right)\\ \mathbf{elif}\;\left(1.0 + z \cdot z\right) \cdot y \le 7.715242497005938 \cdot 10^{+300}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\sqrt{1.0 + z \cdot z} \cdot \left(y \cdot \sqrt{1.0 + z \cdot z}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{1.0} \cdot \sqrt[3]{1.0}\right) \cdot \left(\frac{\sqrt[3]{1.0}}{z \cdot \left(z \cdot \left(x \cdot y\right)\right)} - \frac{\sqrt[3]{1.0} \cdot 1.0}{\left(z \cdot \left(z \cdot \left(x \cdot y\right)\right)\right) \cdot \left(z \cdot z\right)}\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(\sqrt[3]{1.0} \cdot \sqrt[3]{1.0}\right) \cdot \left(\frac{\sqrt[3]{1.0}}{z \cdot \left(z \cdot \left(x \cdot y\right)\right)} - \frac{\sqrt[3]{1.0} \cdot 1.0}{\left(z \cdot \left(z \cdot \left(x \cdot y\right)\right)\right) \cdot \left(z \cdot z\right)}\right)\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r16144640 = 1.0;
        double r16144641 = x;
        double r16144642 = r16144640 / r16144641;
        double r16144643 = y;
        double r16144644 = z;
        double r16144645 = r16144644 * r16144644;
        double r16144646 = r16144640 + r16144645;
        double r16144647 = r16144643 * r16144646;
        double r16144648 = r16144642 / r16144647;
        return r16144648;
}

double f(double x, double y, double z) {
        double r16144649 = 1.0;
        double r16144650 = z;
        double r16144651 = r16144650 * r16144650;
        double r16144652 = r16144649 + r16144651;
        double r16144653 = y;
        double r16144654 = r16144652 * r16144653;
        double r16144655 = -inf.0;
        bool r16144656 = r16144654 <= r16144655;
        double r16144657 = cbrt(r16144649);
        double r16144658 = r16144657 * r16144657;
        double r16144659 = x;
        double r16144660 = r16144659 * r16144653;
        double r16144661 = r16144650 * r16144660;
        double r16144662 = r16144650 * r16144661;
        double r16144663 = r16144657 / r16144662;
        double r16144664 = r16144657 * r16144649;
        double r16144665 = r16144662 * r16144651;
        double r16144666 = r16144664 / r16144665;
        double r16144667 = r16144663 - r16144666;
        double r16144668 = r16144658 * r16144667;
        double r16144669 = 7.715242497005938e+300;
        bool r16144670 = r16144654 <= r16144669;
        double r16144671 = r16144649 / r16144659;
        double r16144672 = sqrt(r16144652);
        double r16144673 = r16144653 * r16144672;
        double r16144674 = r16144672 * r16144673;
        double r16144675 = r16144671 / r16144674;
        double r16144676 = r16144670 ? r16144675 : r16144668;
        double r16144677 = r16144656 ? r16144668 : r16144676;
        return r16144677;
}

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
Herbie2.5
\[\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 div-inv18.4

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

      \[\leadsto \color{blue}{\frac{1.0}{y} \cdot \frac{\frac{1}{x}}{1.0 + z \cdot z}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity14.8

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1.0} \cdot \sqrt[3]{1.0}}{1} \cdot \left(\frac{\sqrt[3]{1.0}}{y} \cdot \frac{\frac{1}{x}}{1.0 + z \cdot z}\right)}\]
    10. Simplified14.8

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

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

      \[\leadsto \frac{\sqrt[3]{1.0} \cdot \sqrt[3]{1.0}}{1} \cdot \color{blue}{\left(\frac{\sqrt[3]{1.0}}{\left(\left(x \cdot y\right) \cdot z\right) \cdot z} - \frac{1.0 \cdot \sqrt[3]{1.0}}{\left(\left(\left(x \cdot y\right) \cdot z\right) \cdot z\right) \cdot \left(z \cdot z\right)}\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}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.5

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