\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq -2.683149926532122 \cdot 10^{+31} \lor \neg \left(z \cdot 3 \leq 22839784493.296265\right):\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot -0.3333333333333333 + \frac{t}{y} \cdot 0.3333333333333333}{z}\\
\end{array}(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
(FPCore (x y z t)
:precision binary64
(if (or (<= (* z 3.0) -2.683149926532122e+31)
(not (<= (* z 3.0) 22839784493.296265)))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y)))
(+ x (/ (+ (* y -0.3333333333333333) (* (/ t y) 0.3333333333333333)) z))))double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
double code(double x, double y, double z, double t) {
double tmp;
if (((z * 3.0) <= -2.683149926532122e+31) || !((z * 3.0) <= 22839784493.296265)) {
tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
} else {
tmp = x + (((y * -0.3333333333333333) + ((t / y) * 0.3333333333333333)) / z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.7 |
|---|---|
| Target | 1.7 |
| Herbie | 0.4 |
if (*.f64 z 3) < -2.683149926532122e31 or 22839784493.29626 < (*.f64 z 3) Initial program 0.4
if -2.683149926532122e31 < (*.f64 z 3) < 22839784493.29626Initial program 9.3
Simplified0.4
rmApplied associate-*l/_binary64_177530.4
rmApplied sub-neg_binary64_178030.4
Applied distribute-rgt-in_binary64_177600.4
Simplified0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2020355
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:herbie-target
(+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))