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}\]
Target
| Original | 6.6 |
| Comparison | 5.9 |
| Herbie | 5.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
- Split input into 2 regimes.
-
if x < -2.92303571655044e+87
Initial program 0.7
\[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]
if -2.92303571655044e+87 < x
Initial program 8.1
\[\frac{\frac{1.0}{x}}{y \cdot \left(1.0 + z \cdot z\right)}\]
- Using strategy
rm
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)}\]
Applied times-frac 7.2
\[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{\frac{1.0}{x}}{1.0 + z \cdot z}}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
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)))))