\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 -1.07422854836868 \cdot 10^{-15} \lor \neg \left(z \le 2.9993001878202427 \cdot 10^{122}\right):\\
\;\;\;\;\mathsf{fma}\left(t \cdot 1, a, \mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 1, a, a \cdot \left(z \cdot b\right) + \mathsf{fma}\left(z, y, x\right)\right)\\
\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 <= -1.0742285483686794e-15) || !(z <= 2.9993001878202427e+122))) {
VAR = ((double) fma(((double) (t * 1.0)), a, ((double) fma(((double) fma(b, a, y)), z, x))));
} else {
VAR = ((double) fma(((double) (t * 1.0)), a, ((double) (((double) (a * ((double) (z * b)))) + ((double) fma(z, y, x))))));
}
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.3 |
| Herbie | 0.4 |
if z < -1.0742285483686794e-15 or 2.9993001878202427e+122 < z Initial program 5.6
rmApplied +-commutative5.6
Applied associate-+l+5.6
Simplified5.6
rmApplied *-un-lft-identity5.6
Applied associate-*r*5.6
Applied fma-def5.6
Taylor expanded around inf 8.2
Simplified0.1
if -1.0742285483686794e-15 < z < 2.9993001878202427e+122Initial program 0.7
rmApplied +-commutative0.7
Applied associate-+l+0.7
Simplified0.7
rmApplied *-un-lft-identity0.7
Applied associate-*r*0.7
Applied fma-def0.7
rmApplied fma-udef0.7
Simplified0.6
Final simplification0.4
herbie shell --seed 2020113 +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)))