Average Error: 58.6 → 0.5
Time: 9.5s
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.6
Target0.5
Herbie0.5
\[x \cdot \left(\left(1 + \frac{x}{2}\right) + \frac{x \cdot x}{6}\right)\]

Derivation

  1. Initial program 58.6

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

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

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

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

Reproduce

herbie shell --seed 2019022 
(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: 9.0s)Debug log

sample97.0ms

Algorithm
intervals
Results
37.0ms109×body1280valid
18.0ms77×body640valid
13.0ms131×body80valid
10.0ms379×pre80true
6.0ms40×body320valid
2.0ms22×body160valid

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: 58.3b

localize6.0ms

Local error

Found 1 expressions with local error:

6.3b
(- (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)

series15.0ms

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

simplify126.0ms

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

prune120.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 3 expressions with local error:

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

rewrite12.0ms

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

series66.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
38.0ms
(* (+ (* x 1/6) 1/2) (* x x))
16.0ms
(+ x (* (+ (* x 1/6) 1/2) (* x x)))
12.0ms
(* x 1/6)

simplify1.2s

Counts
16 → 44
Calls
16 calls:
Slowest
372.0ms
(* (- (* (* x 1/6) (* x 1/6)) (* 1/2 1/2)) (* x x))
315.0ms
(* (+ (pow (* x 1/6) 3) (pow 1/2 3)) (* x x))
128.0ms
(+ x (+ (* 1/6 (pow x 3)) (* 1/2 (pow x 2))))
95.0ms
(+ x (+ (* 1/6 (pow x 3)) (* 1/2 (pow x 2))))
92.0ms
(+ x (+ (* 1/6 (pow x 3)) (* 1/2 (pow x 2))))

prune278.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

localize27.0ms

Local error

Found 4 expressions with local error:

6.1b
(- (* (exp x) (exp x)) (* 1 1))
0.3b
(/ (- (* (exp x) (exp x)) (* 1 1)) (+ (exp x) 1))
0.0b
(* (exp x) (exp x))
0.0b
(+ (exp x) 1)

rewrite45.0ms

Algorithm
rewrite-expression-head
Rules
15×add-cube-cbrt
15×*-un-lft-identity
15×add-sqr-sqrt
12×times-frac
pow1
add-cbrt-cube
add-log-exp
add-exp-log
difference-of-squares
associate-/l*
associate-*l*
associate-*r*
associate-/r*
associate-/l/
flip--
flip-+
associate-/r/
flip3--
flip3-+
div-inv
cbrt-unprod
pow-prod-up
*-commutative
prod-exp
pow-prod-down
div-exp
div-sub
diff-log
pow-plus
frac-2neg
sub-neg
clear-num
+-commutative
cbrt-undiv
pow2
Counts
4 → 79
Calls
4 calls:
Slowest
24.0ms
(/ (- (* (exp x) (exp x)) (* 1 1)) (+ (exp x) 1))
10.0ms
(- (* (exp x) (exp x)) (* 1 1))
6.0ms
(* (exp x) (exp x))
4.0ms
(+ (exp x) 1)

series76.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
36.0ms
(/ (- (* (exp x) (exp x)) (* 1 1)) (+ (exp x) 1))
23.0ms
(- (* (exp x) (exp x)) (* 1 1))
9.0ms
(* (exp x) (exp x))
6.0ms
(+ (exp x) 1)

simplify2.1s

Counts
63 → 91
Calls
63 calls:
Slowest
510.0ms
(/ (* (* (- (* (exp x) (exp x)) (* 1 1)) (- (* (exp x) (exp x)) (* 1 1))) (- (* (exp x) (exp x)) (* 1 1))) (* (* (+ (exp x) 1) (+ (exp x) 1)) (+ (exp x) 1)))
130.0ms
(+ (* 2 x) (+ (* 4/3 (pow x 3)) (* 2 (pow x 2))))
92.0ms
(+ (* (exp x) (exp x)) (- (* 1 1) (* (exp x) 1)))
89.0ms
(+ x (+ (* 1/6 (pow x 3)) (* 1/2 (pow x 2))))
83.0ms
(- (pow (* (exp x) (exp x)) 3) (pow (* 1 1) 3))

prune515.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

localize29.0ms

Local error

Found 4 expressions with local error:

6.3b
(+ (exp (+ x x)) -1)
1.0b
(cbrt (+ (exp x) 1))
1.0b
(cbrt (+ (exp x) 1))
1.0b
(cbrt (+ (exp x) 1))

rewrite10.0ms

Algorithm
rewrite-expression-head
Rules
cbrt-prod
add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
cbrt-div
add-log-exp
flip-+
add-exp-log
add-cbrt-cube
flip3-+
pow1
pow1/3
difference-of-sqr--1
exp-sum
+-commutative
Counts
4 → 51
Calls
4 calls:
Slowest
4.0ms
(+ (exp (+ x x)) -1)
2.0ms
(cbrt (+ (exp x) 1))
2.0ms
(cbrt (+ (exp x) 1))
2.0ms
(cbrt (+ (exp x) 1))

series404.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
145.0ms
(cbrt (+ (exp x) 1))
121.0ms
(cbrt (+ (exp x) 1))
118.0ms
(cbrt (+ (exp x) 1))
20.0ms
(+ (exp (+ x x)) -1)

simplify757.0ms

Counts
29 → 63
Calls
29 calls:
Slowest
143.0ms
(+ (* 2 x) (+ (* 4/3 (pow x 3)) (* 2 (pow x 2))))
131.0ms
(+ (* 1/18 (* (pow x 2) (pow 2 1/3))) (+ (* 1/6 (* x (pow 2 1/3))) (pow 2 1/3)))
122.0ms
(+ (* 1/18 (* (pow x 2) (pow 2 1/3))) (+ (* 1/6 (* x (pow 2 1/3))) (pow 2 1/3)))
117.0ms
(+ (* 1/18 (* (pow x 2) (pow 2 1/3))) (+ (* 1/6 (* x (pow 2 1/3))) (pow 2 1/3)))
50.0ms
(cbrt (- (* (exp x) (exp x)) (* 1 1)))

prune334.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

regimes102.0ms

Accuracy

0% (0.5b remaining)

Error of 0.5b against oracle of 0.1b and baseline of 0.5b

bsearch2.0ms

end0.0ms

sample2.6s

Algorithm
intervals
Results
1.4s3428×body1280valid
438.0ms2495×body640valid
278.0ms11963×pre80true
176.0ms1269×body320valid
120.0ms4164×body80valid
47.0ms607×body160valid