Average Error: 6.7 → 5.9
Time: 2.7s
Precision: 64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{x} \le -9.89983358260154139 \cdot 10^{51} \lor \neg \left(\frac{1}{x} \le 2.6234705384550614 \cdot 10^{-225}\right):\\ \;\;\;\;\frac{1}{y \cdot \left(\sqrt{1 + z \cdot z} \cdot \left(\sqrt{1 + z \cdot z} \cdot x\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\\ \end{array}\]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;\frac{1}{x} \le -9.89983358260154139 \cdot 10^{51} \lor \neg \left(\frac{1}{x} \le 2.6234705384550614 \cdot 10^{-225}\right):\\
\;\;\;\;\frac{1}{y \cdot \left(\sqrt{1 + z \cdot z} \cdot \left(\sqrt{1 + z \cdot z} \cdot x\right)\right)}\\

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

\end{array}
double f(double x, double y, double z) {
        double r329099 = 1.0;
        double r329100 = x;
        double r329101 = r329099 / r329100;
        double r329102 = y;
        double r329103 = z;
        double r329104 = r329103 * r329103;
        double r329105 = r329099 + r329104;
        double r329106 = r329102 * r329105;
        double r329107 = r329101 / r329106;
        return r329107;
}

double f(double x, double y, double z) {
        double r329108 = 1.0;
        double r329109 = x;
        double r329110 = r329108 / r329109;
        double r329111 = -9.899833582601541e+51;
        bool r329112 = r329110 <= r329111;
        double r329113 = 2.6234705384550614e-225;
        bool r329114 = r329110 <= r329113;
        double r329115 = !r329114;
        bool r329116 = r329112 || r329115;
        double r329117 = y;
        double r329118 = z;
        double r329119 = r329118 * r329118;
        double r329120 = r329108 + r329119;
        double r329121 = sqrt(r329120);
        double r329122 = r329121 * r329109;
        double r329123 = r329121 * r329122;
        double r329124 = r329117 * r329123;
        double r329125 = r329108 / r329124;
        double r329126 = r329117 * r329120;
        double r329127 = r329110 / r329126;
        double r329128 = r329116 ? r329125 : r329127;
        return r329128;
}

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.7
Target6.1
Herbie5.9
\[\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.68074325056725162 \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 (/ 1.0 x) < -9.899833582601541e+51 or 2.6234705384550614e-225 < (/ 1.0 x)

    1. Initial program 9.9

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{y \cdot \left(\left(1 + z \cdot z\right) \cdot x\right)}}\]
    8. Using strategy rm
    9. Applied add-sqr-sqrt8.7

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

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

    if -9.899833582601541e+51 < (/ 1.0 x) < 2.6234705384550614e-225

    1. Initial program 1.7

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification5.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{x} \le -9.89983358260154139 \cdot 10^{51} \lor \neg \left(\frac{1}{x} \le 2.6234705384550614 \cdot 10^{-225}\right):\\ \;\;\;\;\frac{1}{y \cdot \left(\sqrt{1 + z \cdot z} \cdot \left(\sqrt{1 + z \cdot z} \cdot x\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2020049 
(FPCore (x y z)
  :name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< (* y (+ 1 (* z z))) #f) (/ (/ 1 y) (* (+ 1 (* z z)) x)) (if (< (* y (+ 1 (* z z))) 8.680743250567252e+305) (/ (/ 1 x) (* (+ 1 (* z z)) y)) (/ (/ 1 y) (* (+ 1 (* z z)) x))))

  (/ (/ 1 x) (* y (+ 1 (* z z)))))