\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 \le -3.2330998000871282 \cdot 10^{-19} \lor \neg \left(z \cdot 3 \le 1.3575263015916868 \cdot 10^{-10}\right):\\
\;\;\;\;\left(x - \frac{\frac{y}{3}}{z}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{\frac{y}{3}}{z}\right) + \frac{1}{z} \cdot \frac{t}{3 \cdot y}\\
\end{array}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 temp;
if ((((z * 3.0) <= -3.233099800087128e-19) || !((z * 3.0) <= 1.3575263015916868e-10))) {
temp = ((x - ((y / 3.0) / z)) + (t / ((z * 3.0) * y)));
} else {
temp = ((x - ((y / 3.0) / z)) + ((1.0 / z) * (t / (3.0 * y))));
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.8 |
|---|---|
| Target | 1.7 |
| Herbie | 0.4 |
if (* z 3.0) < -3.233099800087128e-19 or 1.3575263015916868e-10 < (* z 3.0) Initial program 0.4
rmApplied *-commutative0.4
Applied associate-/r*0.4
if -3.233099800087128e-19 < (* z 3.0) < 1.3575263015916868e-10Initial program 11.2
rmApplied *-commutative11.2
Applied associate-/r*11.2
rmApplied associate-*l*11.2
Applied *-un-lft-identity11.2
Applied times-frac0.3
Final simplification0.4
herbie shell --seed 2020066 +o rules:numerics
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:herbie-target
(+ (- x (/ y (* z 3))) (/ (/ t (* z 3)) y))
(+ (- x (/ y (* z 3))) (/ t (* (* z 3) y))))