\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\begin{array}{l}
\mathbf{if}\;z \leq 2.231734751983997 \cdot 10^{-117}:\\
\;\;\;\;\left(\mathsf{fma}\left(z, y, x\right) + a \cdot t\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), x\right)\right)\\
\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 (if (<= z 2.231734751983997e-117) (+ (+ (fma z y x) (* a t)) (* (* z a) b)) (fma a t (fma z (fma a b y) x))))
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 tmp;
if (z <= 2.231734751983997e-117) {
tmp = (fma(z, y, x) + (a * t)) + ((z * a) * b);
} else {
tmp = fma(a, t, fma(z, fma(a, b, y), x));
}
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 | 1.9 |
|---|---|
| Target | 0.4 |
| Herbie | 1.3 |
if z < 2.2317347519839971e-117Initial program 1.4
rmApplied add-log-exp_binary6427.6
Applied add-log-exp_binary6442.5
Applied add-log-exp_binary6459.7
Applied sum-log_binary6459.7
Applied sum-log_binary6459.7
Applied log-prod_binary6459.7
Simplified27.6
Simplified1.4
if 2.2317347519839971e-117 < z Initial program 3.0
rmApplied add-log-exp_binary6429.8
Applied add-log-exp_binary6441.6
Applied add-log-exp_binary6455.7
Applied add-log-exp_binary6463.0
Applied sum-log_binary6463.0
Applied sum-log_binary6463.0
Applied sum-log_binary6463.0
Applied log-prod_binary6463.0
Simplified29.8
Simplified4.4
Taylor expanded around 0 4.4
Simplified1.1
Final simplification1.3
herbie shell --seed 2021211
(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)))