x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}
\begin{array}{l}
\mathbf{if}\;z \leq -4.3802569374033836 \cdot 10^{-153} \lor \neg \left(z \leq 1.1593343701556162 \cdot 10^{-211}\right):\\
\;\;\;\;x - \frac{y}{z - \frac{y \cdot t}{z \cdot 2}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, \frac{z}{t}, x\right)\\
\end{array}
(FPCore (x y z t) :precision binary64 (- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t)))))
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.3802569374033836e-153) (not (<= z 1.1593343701556162e-211))) (- x (/ y (- z (/ (* y t) (* z 2.0))))) (fma 2.0 (/ z t) x)))
double code(double x, double y, double z, double t) {
return x - (((y * 2.0) * z) / (((z * 2.0) * z) - (y * t)));
}
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.3802569374033836e-153) || !(z <= 1.1593343701556162e-211)) {
tmp = x - (y / (z - ((y * t) / (z * 2.0))));
} else {
tmp = fma(2.0, (z / t), x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 11.1 |
|---|---|
| Target | 0.1 |
| Herbie | 2.1 |
if z < -4.3802569374033836e-153 or 1.15933437015561615e-211 < z Initial program 11.8
Simplified2.3
if -4.3802569374033836e-153 < z < 1.15933437015561615e-211Initial program 8.3
Simplified4.7
Taylor expanded in y around inf 1.1
Simplified1.1
Final simplification2.1
herbie shell --seed 2021313
(FPCore (x y z t)
:name "Numeric.AD.Rank1.Halley:findZero from ad-4.2.4"
:precision binary64
:herbie-target
(- x (/ 1.0 (- (/ z y) (/ (/ t 2.0) z))))
(- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t)))))