a \cdot \left(\left(b + c\right) + d\right)
\mathsf{fma}\left(a, b + c, d \cdot a\right)double f(double a, double b, double c, double d) {
double r3491400 = a;
double r3491401 = b;
double r3491402 = c;
double r3491403 = r3491401 + r3491402;
double r3491404 = d;
double r3491405 = r3491403 + r3491404;
double r3491406 = r3491400 * r3491405;
return r3491406;
}
double f(double a, double b, double c, double d) {
double r3491407 = a;
double r3491408 = b;
double r3491409 = c;
double r3491410 = r3491408 + r3491409;
double r3491411 = d;
double r3491412 = r3491411 * r3491407;
double r3491413 = fma(r3491407, r3491410, r3491412);
return r3491413;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
| Original | 0.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 0.0
rmApplied distribute-lft-in0.0
rmApplied fma-def0.0
Final simplification0.0
herbie shell --seed 2019164 +o rules:numerics
(FPCore (a b c d)
:name "Expression, p14"
:pre (and (<= 56789 a 98765) (<= 0 b 1) (<= 0 c 0.0016773) (<= 0 d 0.0016773))
:herbie-target
(+ (* a b) (* a (+ c d)))
(* a (+ (+ b c) d)))