\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, z, \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), x\right)\right)\\
\mathbf{if}\;a \leq -1.4537501272190535 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 3.7766997801208336 \cdot 10^{-88}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma y z (fma a (fma z b t) x))))
(if (<= a -1.4537501272190535e+55)
t_1
(if (<= a 3.7766997801208336e-88) (fma a t (fma z (fma a b y) x)) t_1))))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 t_1 = fma(y, z, fma(a, fma(z, b, t), x));
double tmp;
if (a <= -1.4537501272190535e+55) {
tmp = t_1;
} else if (a <= 3.7766997801208336e-88) {
tmp = fma(a, t, fma(z, fma(a, b, y), x));
} else {
tmp = t_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b
| Original | 2.2 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
if a < -1.45375012721905352e55 or 3.77669978012083358e-88 < a Initial program 4.5
Simplified0.5
if -1.45375012721905352e55 < a < 3.77669978012083358e-88Initial program 0.5
Simplified4.5
Taylor expanded in y around 0 4.5
Simplified0.2
Final simplification0.3
herbie shell --seed 2022097
(FPCore (x y z t a b)
:name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
:precision binary64
:herbie-target
(if (< z -11820553527347888000.0) (+ (* 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)))