Average Error: 6.3 → 3.5
Time: 49.1s
Precision: 64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.075470482331493311969829664152890033654 \cdot 10^{137}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z}\\ \mathbf{elif}\;z \le 5.011064830926822850239479880900929355774 \cdot 10^{56}:\\ \;\;\;\;\frac{\frac{1}{x}}{\sqrt{1 + z \cdot z}} \cdot \frac{1}{\sqrt{1 + z \cdot z} \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z}\\ \end{array}\]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;z \le -1.075470482331493311969829664152890033654 \cdot 10^{137}:\\
\;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z}\\

\mathbf{elif}\;z \le 5.011064830926822850239479880900929355774 \cdot 10^{56}:\\
\;\;\;\;\frac{\frac{1}{x}}{\sqrt{1 + z \cdot z}} \cdot \frac{1}{\sqrt{1 + z \cdot z} \cdot y}\\

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

\end{array}
double f(double x, double y, double z) {
        double r15234893 = 1.0;
        double r15234894 = x;
        double r15234895 = r15234893 / r15234894;
        double r15234896 = y;
        double r15234897 = z;
        double r15234898 = r15234897 * r15234897;
        double r15234899 = r15234893 + r15234898;
        double r15234900 = r15234896 * r15234899;
        double r15234901 = r15234895 / r15234900;
        return r15234901;
}

double f(double x, double y, double z) {
        double r15234902 = z;
        double r15234903 = -1.0754704823314933e+137;
        bool r15234904 = r15234902 <= r15234903;
        double r15234905 = 1.0;
        double r15234906 = x;
        double r15234907 = r15234905 / r15234906;
        double r15234908 = y;
        double r15234909 = r15234902 * r15234908;
        double r15234910 = r15234909 * r15234902;
        double r15234911 = r15234907 / r15234910;
        double r15234912 = 5.011064830926823e+56;
        bool r15234913 = r15234902 <= r15234912;
        double r15234914 = r15234902 * r15234902;
        double r15234915 = r15234905 + r15234914;
        double r15234916 = sqrt(r15234915);
        double r15234917 = r15234907 / r15234916;
        double r15234918 = 1.0;
        double r15234919 = r15234916 * r15234908;
        double r15234920 = r15234918 / r15234919;
        double r15234921 = r15234917 * r15234920;
        double r15234922 = r15234913 ? r15234921 : r15234911;
        double r15234923 = r15234904 ? r15234911 : r15234922;
        return r15234923;
}

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.3
Target5.5
Herbie3.5
\[\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.0754704823314933e+137 or 5.011064830926823e+56 < z

    1. Initial program 14.7

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

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

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

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

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

    if -1.0754704823314933e+137 < z < 5.011064830926823e+56

    1. Initial program 1.4

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

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

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\left(y \cdot \sqrt{1 + z \cdot z}\right) \cdot \sqrt{1 + z \cdot z}}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity1.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.075470482331493311969829664152890033654 \cdot 10^{137}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z}\\ \mathbf{elif}\;z \le 5.011064830926822850239479880900929355774 \cdot 10^{56}:\\ \;\;\;\;\frac{\frac{1}{x}}{\sqrt{1 + z \cdot z}} \cdot \frac{1}{\sqrt{1 + z \cdot z} \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(z \cdot y\right) \cdot z}\\ \end{array}\]

Reproduce

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