\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\begin{array}{l}
\mathbf{if}\;z \le -4.9542557062808695 \cdot 10^{-76} \lor \neg \left(z \le 1.24921865967369847 \cdot 10^{-89}\right):\\
\;\;\;\;\mathsf{fma}\left(a, b, y\right) \cdot z + \mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\
\end{array}double code(double x, double y, double z, double t, double a, double b) {
return ((double) (((double) (((double) (x + ((double) (y * z)))) + ((double) (t * a)))) + ((double) (((double) (a * z)) * b))));
}
double code(double x, double y, double z, double t, double a, double b) {
double VAR;
if (((z <= -4.9542557062808695e-76) || !(z <= 1.2492186596736985e-89))) {
VAR = ((double) (((double) (((double) fma(a, b, y)) * z)) + ((double) fma(a, t, x))));
} else {
VAR = ((double) (((double) (((double) (x + ((double) (y * z)))) + ((double) (t * a)))) + ((double) (((double) (a * z)) * b))));
}
return VAR;
}




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.1 |
|---|---|
| Target | 0.4 |
| Herbie | 0.6 |
if z < -4.9542557062808695e-76 or 1.2492186596736985e-89 < z Initial program 3.5
Simplified0.7
rmApplied fma-udef0.7
if -4.9542557062808695e-76 < z < 1.2492186596736985e-89Initial program 0.5
Final simplification0.6
herbie shell --seed 2020120 +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)))