Average Error: 6.6 → 5.9
Time: 24.9s
Precision: 64
Internal precision: 128
\[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.92303571655044 \cdot 10^{+87}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{\frac{1.0}{x}}{1.0 + z \cdot z}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original6.6
Comparison5.9
Herbie5.9
\[ \begin{array}{l} \mathbf{if}\;y \cdot \left(1.0 + z \cdot z\right) \lt -inf.0:\\ \;\;\;\;\frac{\frac{1.0}{y}}{\left(1.0 + {z}^2\right) \cdot x}\\ \mathbf{if}\;y \cdot \left(1.0 + z \cdot z\right) \lt 8.680743250567252 \cdot 10^{+305}:\\ \;\;\;\;\frac{\frac{1.0}{x}}{\left(1.0 + {z}^2\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1.0}{y}}{\left(1.0 + {z}^2\right) \cdot x}\\ \end{array} \]

Derivation

  1. Split input into 2 regimes.
  2. if x < -2.92303571655044e+87

    1. Initial program 0.7

      \[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]

    if -2.92303571655044e+87 < x

    1. Initial program 8.1

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

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{\frac{1.0}{x}}{1.0 + z \cdot z}}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 24.9s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(3455118682 3690941017 4040958670 2916590910 2639037942 2604149229)'
(FPCore (x y z)
  :name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"

  :target
  (if (< (* y (+ 1.0 (* z z))) -inf.0) (/ (/ 1.0 y) (* (+ 1.0 (sqr z)) x)) (if (< (* y (+ 1.0 (* z z))) 8.680743250567252e+305) (/ (/ 1.0 x) (* (+ 1.0 (sqr z)) y)) (/ (/ 1.0 y) (* (+ 1.0 (sqr z)) x))))

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