\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\begin{array}{l}
\mathbf{if}\;t \leq 6.264993903807226 \cdot 10^{-26}:\\
\;\;\;\;x + \frac{\frac{\frac{t}{y} - y}{z}}{3}\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\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 (<= t 6.264993903807226e-26) (+ x (/ (/ (- (/ t y) y) z) 3.0)) (+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))))
double code(double x, double y, double z, double t) {
return ((double) (((double) (x - (y / ((double) (z * 3.0))))) + (t / ((double) (((double) (z * 3.0)) * y)))));
}
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= 6.264993903807226e-26)) {
tmp = ((double) (x + ((((double) ((t / y) - y)) / z) / 3.0)));
} else {
tmp = ((double) (((double) (x - (y / ((double) (z * 3.0))))) + (t / ((double) (y * ((double) (z * 3.0)))))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.6 |
|---|---|
| Target | 1.8 |
| Herbie | 2.1 |
if t < 6.26499390380722575e-26Initial program Error: 4.4 bits
SimplifiedError: 2.6 bits
rmApplied associate-/r*Error: 2.6 bits
if 6.26499390380722575e-26 < t Initial program Error: 0.6 bits
Final simplificationError: 2.1 bits
herbie shell --seed 2020204
(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))))