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 -1.46560191932161036 \cdot 10^{-85}:\\
\;\;\;\;x - \frac{y \cdot 2}{\left(\left(z \cdot 2\right) \cdot z - y \cdot t\right) \cdot \frac{1}{z}}\\
\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))) <= -1.4656019193216104e-85)) {
VAR = (x - ((y * 2.0) / ((((z * 2.0) * z) - (y * t)) * (1.0 / z))));
} 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.5 |
|---|---|
| Target | 0.1 |
| Herbie | 1.9 |
if (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t))) < -1.4656019193216104e-85Initial program 5.3
rmApplied associate-/l*1.1
rmApplied div-inv1.1
if -1.4656019193216104e-85 < (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t))) Initial program 12.3
rmApplied associate-/l*7.5
rmApplied div-sub7.5
Simplified3.2
Simplified3.2
rmApplied *-un-lft-identity3.2
Applied times-frac2.1
Simplified2.1
Final simplification1.9
herbie shell --seed 2020079 +o rules:numerics
(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)))))