\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
\left(e^{\mathsf{log1p}\left(\left(a + \left(b + c\right)\right) + d\right)} - 1\right) \cdot 2double f(double a, double b, double c, double d) {
double r75569 = a;
double r75570 = b;
double r75571 = c;
double r75572 = d;
double r75573 = r75571 + r75572;
double r75574 = r75570 + r75573;
double r75575 = r75569 + r75574;
double r75576 = 2.0;
double r75577 = r75575 * r75576;
return r75577;
}
double f(double a, double b, double c, double d) {
double r75578 = a;
double r75579 = b;
double r75580 = c;
double r75581 = r75579 + r75580;
double r75582 = r75578 + r75581;
double r75583 = d;
double r75584 = r75582 + r75583;
double r75585 = log1p(r75584);
double r75586 = exp(r75585);
double r75587 = 1.0;
double r75588 = r75586 - r75587;
double r75589 = 2.0;
double r75590 = r75588 * r75589;
return r75590;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.6 |
|---|---|
| Target | 3.8 |
| Herbie | 3.0 |
Initial program 3.6
rmApplied associate-+r+2.8
rmApplied associate-+r+2.8
rmApplied expm1-log1p-u3.0
rmApplied expm1-udef3.0
Final simplification3.0
herbie shell --seed 2020049 +o rules:numerics
(FPCore (a b c d)
:name "Expression, p6"
:precision binary64
:pre (and (<= -14 a -13) (<= -3 b -2) (<= 3 c 3.5) (<= 12.5 d 13.5))
:herbie-target
(+ (* (+ a b) 2) (* (+ c d) 2))
(* (+ a (+ b (+ c d))) 2))