\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\begin{array}{l}
\mathbf{if}\;t \leq -1.153736389036113 \cdot 10^{-20} \lor \neg \left(t \leq 9.039394313155043 \cdot 10^{-52}\right):\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-0.3333333333333333}{\frac{z}{y - \frac{t}{y}}}\\
\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 (<= t -1.153736389036113e-20) (not (<= t 9.039394313155043e-52))) (+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0)))) (+ x (/ -0.3333333333333333 (/ z (- y (/ t y)))))))
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 ((t <= -1.153736389036113e-20) || !(t <= 9.039394313155043e-52)) {
tmp = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
} else {
tmp = x + (-0.3333333333333333 / (z / (y - (t / y))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.7 |
|---|---|
| Target | 1.8 |
| Herbie | 0.4 |
if t < -1.153736389036113e-20 or 9.03939431315504343e-52 < t Initial program 0.6
if -1.153736389036113e-20 < t < 9.03939431315504343e-52Initial program 6.7
Simplified0.2
rmApplied associate-*l/_binary64_208220.2
rmApplied associate-/l*_binary64_208240.2
Final simplification0.4
herbie shell --seed 2021007
(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))))