\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 1.2927454047009987 \cdot 10^{+20}:\\
\;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + {z}^{6}\right)} \cdot \left(1 + \left(\left(z \cdot z\right) \cdot \left(z \cdot z\right) - z \cdot z\right)\right)\\
\mathbf{elif}\;z \cdot z \leq 2.085299800624733 \cdot 10^{+245}:\\
\;\;\;\;\frac{\sqrt[3]{\frac{1}{x}} \cdot \sqrt[3]{\frac{1}{x}}}{y} \cdot \left(\frac{\sqrt[3]{\frac{1}{x}}}{z} \cdot \left(\frac{1}{z} - \frac{1}{{z}^{3}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{y + z \cdot \left(z \cdot y\right)}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
(FPCore (x y z)
:precision binary64
(if (<= (* z z) 1.2927454047009987e+20)
(*
(/ (/ 1.0 x) (* y (+ 1.0 (pow z 6.0))))
(+ 1.0 (- (* (* z z) (* z z)) (* z z))))
(if (<= (* z z) 2.085299800624733e+245)
(*
(/ (* (cbrt (/ 1.0 x)) (cbrt (/ 1.0 x))) y)
(* (/ (cbrt (/ 1.0 x)) z) (- (/ 1.0 z) (/ 1.0 (pow z 3.0)))))
(/ (/ 1.0 x) (+ y (* z (* z y)))))))double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1.2927454047009987e+20) {
tmp = ((1.0 / x) / (y * (1.0 + pow(z, 6.0)))) * (1.0 + (((z * z) * (z * z)) - (z * z)));
} else if ((z * z) <= 2.085299800624733e+245) {
tmp = ((cbrt(1.0 / x) * cbrt(1.0 / x)) / y) * ((cbrt(1.0 / x) / z) * ((1.0 / z) - (1.0 / pow(z, 3.0))));
} else {
tmp = (1.0 / x) / (y + (z * (z * y)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.0 |
|---|---|
| Target | 5.3 |
| Herbie | 3.4 |
if (*.f64 z z) < 129274540470099870000Initial program 0.3
rmApplied flip3-+_binary640.3
Applied associate-*r/_binary640.3
Applied associate-/r/_binary640.3
Simplified0.3
if 129274540470099870000 < (*.f64 z z) < 2.0852998006247331e245Initial program 4.9
rmApplied add-cube-cbrt_binary645.6
Applied times-frac_binary643.8
Taylor expanded around inf 35.0
Simplified3.8
if 2.0852998006247331e245 < (*.f64 z z) Initial program 15.2
rmApplied distribute-lft-in_binary6415.2
Simplified15.2
rmApplied associate-*r*_binary647.8
Final simplification3.4
herbie shell --seed 2020231
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< (* y (+ 1.0 (* z z))) (- INFINITY)) (/ (/ 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)))))