double code(double a, double x) {
return ((double) (((double) exp(((double) (a * x)))) - 1.0));
}
double code(double a, double x) {
double VAR;
if ((((double) (a * x)) <= -0.0035314901518229964)) {
VAR = ((double) (((double) exp(((double) (a * x)))) - 1.0));
} else {
VAR = ((double) (((double) (a * ((double) (x + ((double) (x * ((double) (a * ((double) (x * 0.5)))))))))) + ((double) (0.16666666666666666 * ((double) pow(((double) (a * x)), 3.0))))));
}
return VAR;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.4 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (* a x) < -0.00353149015182299643Initial program 0.0
if -0.00353149015182299643 < (* a x) Initial program 44.6
Taylor expanded around 0 14.8
Simplified7.9
rmApplied distribute-lft-in7.9
Simplified7.8
Taylor expanded around inf 14.8
Simplified0.5
Final simplification0.4
herbie shell --seed 2020181
(FPCore (a x)
:name "expax (section 3.5)"
:precision binary64
:herbie-expected 14
:herbie-target
(if (< (fabs (* a x)) 0.1) (* (* a x) (+ 1.0 (+ (/ (* a x) 2.0) (/ (pow (* a x) 2.0) 6.0)))) (- (exp (* a x)) 1.0))
(- (exp (* a x)) 1.0))