Average Error: 58.8 → 0.4
Time: 3.7s
Precision: 64
Internal Precision: 128
\[e^{x} - 1\]
\[x + \left(\frac{1}{2} + x \cdot \frac{1}{6}\right) \cdot \left(x \cdot x\right)\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original58.8
Target0.5
Herbie0.4
\[x \cdot \left(\left(1 + \frac{x}{2}\right) + \frac{x \cdot x}{6}\right)\]

Derivation

  1. Initial program 58.8

    \[e^{x} - 1\]
  2. Taylor expanded around 0 0.4

    \[\leadsto \color{blue}{x + \left(\frac{1}{6} \cdot {x}^{3} + \frac{1}{2} \cdot {x}^{2}\right)}\]
  3. Simplified0.4

    \[\leadsto \color{blue}{x + \left(x \cdot \frac{1}{6} + \frac{1}{2}\right) \cdot \left(x \cdot x\right)}\]
  4. Final simplification0.4

    \[\leadsto x + \left(\frac{1}{2} + x \cdot \frac{1}{6}\right) \cdot \left(x \cdot x\right)\]

Reproduce

herbie shell --seed 2019016 
(FPCore (x)
  :name "expm1 (example 3.7)"
  :pre (< -0.00017 x)

  :herbie-target
  (* x (+ (+ 1 (/ x 2)) (/ (* x x) 6)))

  (- (exp x) 1))

Details

Time bar (total: 3.5s)Debug log

sample92.0ms

Algorithm
intervals
Results
366×(pre true 80)
112×(body real 1280)
110×(body real 80)
79×(body real 640)
44×(body real 320)
21×(body real 160)

simplify3.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
3.0ms
(- (exp x) 1)

prune4.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 59.6b

localize5.0ms

Local error

Found 1 expressions with local error:

6.0b
(- (exp x) 1)

rewrite3.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-log-exp
flip--
add-cube-cbrt
add-exp-log
difference-of-sqr-1
add-cbrt-cube
flip3--
*-un-lft-identity
sub-neg
pow1
Counts
1 → 12
Calls
1 calls:
Slowest
3.0ms
(- (exp x) 1)

series12.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
12.0ms
(- (exp x) 1)

simplify92.0ms

Counts
4 → 15
Calls
4 calls:
Slowest
84.0ms
(+ x (+ (* 1/6 (pow x 3)) (* 1/2 (pow x 2))))
3.0ms
(- (exp x) 1)
3.0ms
(- (exp x) 1)
2.0ms
(+ (sqrt (exp x)) 1)

prune70.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0b

localize14.0ms

Local error

Found 2 expressions with local error:

0.3b
(* x 1/6)
0.0b
(* (+ (* x 1/6) 1/2) (* x x))

rewrite6.0ms

Algorithm
rewrite-expression-head
Rules
add-exp-log
add-cbrt-cube
pow1
add-cube-cbrt
associate-*l*
*-un-lft-identity
add-sqr-sqrt
add-log-exp
*-commutative
associate-*l/
flip-+
cbrt-unprod
prod-exp
pow-prod-down
associate-*r*
flip3-+
Counts
2 → 25
Calls
2 calls:
Slowest
5.0ms
(* (+ (* x 1/6) 1/2) (* x x))
0.0ms
(* x 1/6)

series36.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
29.0ms
(* (+ (* x 1/6) 1/2) (* x x))
8.0ms
(* x 1/6)

simplify981.0ms

Counts
13 → 31
Calls
13 calls:
Slowest
470.0ms
(* (- (* (* x 1/6) (* x 1/6)) (* 1/2 1/2)) (* x x))
300.0ms
(* (+ (pow (* x 1/6) 3) (pow 1/2 3)) (* x x))
69.0ms
(* (* (* (+ (* x 1/6) 1/2) (+ (* x 1/6) 1/2)) (+ (* x 1/6) 1/2)) (* (* (* x x) (* x x)) (* x x)))
44.0ms
(+ (* 1/6 (pow x 3)) (* 1/2 (pow x 2)))
31.0ms
(+ (* 1/6 (pow x 3)) (* 1/2 (pow x 2)))

prune150.0ms

Pruning

1 alts after pruning (0 fresh and 1 done)

Merged error: 0b

end0.0ms

sample2.1s

Algorithm
intervals
Results
11928×(pre true 80)
4111×(body real 80)
3468×(body real 1280)
2488×(body real 640)
1225×(body real 320)
636×(body real 160)