\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 -5.340817638704946 \cdot 10^{-84} \lor \neg \left(z \cdot 3 \leq 9.199046531699814 \cdot 10^{+119}\right):\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{\frac{t}{y} - y}{z}, x\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 (or (<= (* z 3.0) -5.340817638704946e-84)
(not (<= (* z 3.0) 9.199046531699814e+119)))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y)))
(fma 0.3333333333333333 (/ (- (/ t y) y) z) x)))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) <= -5.340817638704946e-84) || !((z * 3.0) <= 9.199046531699814e+119)) {
tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
} else {
tmp = fma(0.3333333333333333, (((t / y) - y) / z), x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 3.6 |
|---|---|
| Target | 1.7 |
| Herbie | 0.9 |
if (*.f64 z 3) < -5.3408176387049462e-84 or 9.19904653169981393e119 < (*.f64 z 3) Initial program 0.6
if -5.3408176387049462e-84 < (*.f64 z 3) < 9.19904653169981393e119Initial program 8.4
Simplified1.2
Applied div-inv_binary641.2
Taylor expanded in z around 0 8.6
Simplified1.3
Final simplification0.9
herbie shell --seed 2022068
(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))))