x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}\begin{array}{l}
\mathbf{if}\;\frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t} \le 2.16044434164362097 \cdot 10^{148}:\\
\;\;\;\;x - \frac{y}{\left(z \cdot 2\right) \cdot z - y \cdot t} \cdot \left(z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot 2}{z \cdot 2 - t \cdot \frac{y}{z}}\\
\end{array}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 VAR;
if (((((y * 2.0) * z) / (((z * 2.0) * z) - (y * t))) <= 2.160444341643621e+148)) {
VAR = (x - ((y / (((z * 2.0) * z) - (y * t))) * (z * 2.0)));
} else {
VAR = (x - ((y * 2.0) / ((z * 2.0) - (t * (y / z)))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 11.6 |
|---|---|
| Target | 0.1 |
| Herbie | 1.6 |
if (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t))) < 2.160444341643621e+148Initial program 3.1
rmApplied associate-/l*1.9
rmApplied div-inv1.9
Applied times-frac1.5
Simplified1.5
if 2.160444341643621e+148 < (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t))) Initial program 60.5
rmApplied associate-/l*33.0
rmApplied div-sub33.0
Simplified11.9
Simplified11.9
rmApplied *-un-lft-identity11.9
Applied times-frac2.1
Simplified2.1
Final simplification1.6
herbie shell --seed 2020100
(FPCore (x y z t)
:name "Numeric.AD.Rank1.Halley:findZero from ad-4.2.4"
:precision binary64
:herbie-target
(- x (/ 1 (- (/ z y) (/ (/ t 2) z))))
(- x (/ (* (* y 2) z) (- (* (* z 2) z) (* y t)))))