\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\left(b + c\right) + \left(d + a\right)\right)\right)\right)\right)double f(double a, double b, double c, double d) {
double r2359469 = a;
double r2359470 = b;
double r2359471 = c;
double r2359472 = d;
double r2359473 = r2359471 + r2359472;
double r2359474 = r2359470 + r2359473;
double r2359475 = r2359469 + r2359474;
double r2359476 = 2.0;
double r2359477 = r2359475 * r2359476;
return r2359477;
}
double f(double a, double b, double c, double d) {
double r2359478 = 2.0;
double r2359479 = b;
double r2359480 = c;
double r2359481 = r2359479 + r2359480;
double r2359482 = d;
double r2359483 = a;
double r2359484 = r2359482 + r2359483;
double r2359485 = r2359481 + r2359484;
double r2359486 = expm1(r2359485);
double r2359487 = log1p(r2359486);
double r2359488 = r2359478 * r2359487;
return r2359488;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.6 |
|---|---|
| Target | 3.8 |
| Herbie | 0.1 |
Initial program 3.6
rmApplied associate-+r+2.8
rmApplied log1p-expm1-u2.8
rmApplied add-cbrt-cube2.9
Taylor expanded around -inf 3.7
Simplified0.1
Final simplification0.1
herbie shell --seed 2019133 +o rules:numerics
(FPCore (a b c d)
:name "Expression, p6"
: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))