\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\begin{array}{l}
\mathbf{if}\;y \le -3.33708536885465591 \cdot 10^{27} \lor \neg \left(y \le 7.65054983027430947 \cdot 10^{-137}\right):\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right) + a \cdot \left(z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(a, b, y\right), z, \mathsf{fma}\left(a, t, x\right)\right)\\
\end{array}double code(double x, double y, double z, double t, double a, double b) {
return (((x + (y * z)) + (t * a)) + ((a * z) * b));
}
double code(double x, double y, double z, double t, double a, double b) {
double temp;
if (((y <= -3.337085368854656e+27) || !(y <= 7.650549830274309e-137))) {
temp = (fma(a, t, fma(z, y, x)) + (a * (z * b)));
} else {
temp = fma(fma(a, b, y), z, fma(a, t, x));
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b
Results
| Original | 2.0 |
|---|---|
| Target | 0.3 |
| Herbie | 2.2 |
if y < -3.337085368854656e+27 or 7.650549830274309e-137 < y Initial program 1.3
rmApplied associate-*l*2.2
rmApplied associate-+l+2.2
Simplified2.2
rmApplied fma-udef2.2
Applied associate-+r+2.2
Simplified2.2
if -3.337085368854656e+27 < y < 7.650549830274309e-137Initial program 2.9
Simplified2.3
Final simplification2.2
herbie shell --seed 2020049 +o rules:numerics
(FPCore (x y z t a b)
:name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
:precision binary64
:herbie-target
(if (< z -11820553527347888000) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 4.7589743188364287e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))