Average Error: 29.4 → 0.4
Time: 2.8s
Precision: binary64
\[\]
\[\]
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;
}

Error

Bits error versus a

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original29.4
Target0.2
Herbie0.4
\[\]

Derivation

  1. Split input into 2 regimes
  2. if (* a x) < -0.00353149015182299643

    1. Initial program 0.0

      \[\]

    if -0.00353149015182299643 < (* a x)

    1. Initial program 44.6

      \[\]
    2. Taylor expanded around 0 14.8

      \[\leadsto \]
    3. Simplified7.9

      \[\leadsto \]
    4. Using strategy rm
    5. Applied distribute-lft-in7.9

      \[\leadsto \]
    6. Simplified7.8

      \[\leadsto \]
    7. Taylor expanded around inf 14.8

      \[\leadsto \]
    8. Simplified0.5

      \[\leadsto \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \]

Reproduce

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))