Average Error: 6.5 → 2.0
Time: 11.8s
Precision: 64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot z \le 4.052108237063258146574851851160968341006 \cdot 10^{262}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(y \cdot z\right) \cdot z + y \cdot 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{x}}{z}}{y \cdot z}\\ \end{array}\]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;z \cdot z \le 4.052108237063258146574851851160968341006 \cdot 10^{262}:\\
\;\;\;\;\frac{\frac{1}{x}}{\left(y \cdot z\right) \cdot z + y \cdot 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{z}}{y \cdot z}\\

\end{array}
double f(double x, double y, double z) {
        double r179890 = 1.0;
        double r179891 = x;
        double r179892 = r179890 / r179891;
        double r179893 = y;
        double r179894 = z;
        double r179895 = r179894 * r179894;
        double r179896 = r179890 + r179895;
        double r179897 = r179893 * r179896;
        double r179898 = r179892 / r179897;
        return r179898;
}

double f(double x, double y, double z) {
        double r179899 = z;
        double r179900 = r179899 * r179899;
        double r179901 = 4.052108237063258e+262;
        bool r179902 = r179900 <= r179901;
        double r179903 = 1.0;
        double r179904 = x;
        double r179905 = r179903 / r179904;
        double r179906 = y;
        double r179907 = r179906 * r179899;
        double r179908 = r179907 * r179899;
        double r179909 = r179906 * r179903;
        double r179910 = r179908 + r179909;
        double r179911 = r179905 / r179910;
        double r179912 = r179905 / r179899;
        double r179913 = r179912 / r179907;
        double r179914 = r179902 ? r179911 : r179913;
        return r179914;
}

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.7
Herbie2.0
\[\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 z) < 4.052108237063258e+262

    1. Initial program 2.1

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

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

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

    if 4.052108237063258e+262 < (* z z)

    1. Initial program 16.7

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \le 4.052108237063258146574851851160968341006 \cdot 10^{262}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(y \cdot z\right) \cdot z + y \cdot 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{x}}{z}}{y \cdot z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019179 +o rules:numerics
(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)))))