Average Error: 58.8 → 0.4
Time: 35.8s
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.4
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 2019010 
(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: 35.4s)Debug log

sample104.0ms

Algorithm
intervals

simplify6.0ms

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

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 59.3b

localize23.0ms

Local error

Found 1 expressions with local error:

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

simplify123.0ms

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

prune96.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

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

rewrite15.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
10.0ms
(* (+ (* x 1/6) 1/2) (* x x))
3.0ms
(+ x (* (+ (* x 1/6) 1/2) (* x x)))
0.0ms
(* x 1/6)

series50.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
27.0ms
(* (+ (* x 1/6) 1/2) (* x x))
14.0ms
(+ x (* (+ (* x 1/6) 1/2) (* x x)))
9.0ms
(* x 1/6)

simplify1.3s

Counts
16 → 44
Calls
16 calls:
Slowest
429.0ms
(* (- (* (* x 1/6) (* x 1/6)) (* 1/2 1/2)) (* x x))
322.0ms
(* (+ (pow (* x 1/6) 3) (pow 1/2 3)) (* x x))
134.0ms
(+ x (+ (* 1/6 (pow x 3)) (* 1/2 (pow x 2))))
118.0ms
(+ x (+ (* 1/6 (pow x 3)) (* 1/2 (pow x 2))))
101.0ms
(+ x (+ (* 1/6 (pow x 3)) (* 1/2 (pow x 2))))

prune260.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize24.0ms

Local error

Found 4 expressions with local error:

41.3b
(/ (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)) (+ (* x x) (- (* (* (+ (* x 1/6) 1/2) (* x x)) (* (+ (* x 1/6) 1/2) (* x x))) (* x (* (+ (* x 1/6) 1/2) (* x x))))))
0.3b
(* x 1/6)
0.3b
(* x 1/6)
0.3b
(* x 1/6)

rewrite98.0ms

Algorithm
rewrite-expression-head
Rules
22×*-un-lft-identity
15×times-frac
14×add-cube-cbrt
14×add-sqr-sqrt
add-exp-log
add-cbrt-cube
associate-/l*
add-log-exp
distribute-lft-out
sum-cubes
pow1
*-commutative
associate-/r*
associate-/l/
flip-+
associate-/r/
flip3-+
div-inv
div-exp
frac-2neg
clear-num
cbrt-undiv
Counts
4 → 63
Calls
4 calls:
Slowest
95.0ms
(/ (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)) (+ (* x x) (- (* (* (+ (* x 1/6) 1/2) (* x x)) (* (+ (* x 1/6) 1/2) (* x x))) (* x (* (+ (* x 1/6) 1/2) (* x x))))))
0.0ms
(* x 1/6)
0.0ms
(* x 1/6)
0.0ms
(* x 1/6)

series121.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
86.0ms
(/ (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)) (+ (* x x) (- (* (* (+ (* x 1/6) 1/2) (* x x)) (* (+ (* x 1/6) 1/2) (* x x))) (* x (* (+ (* x 1/6) 1/2) (* x x))))))
14.0ms
(* x 1/6)
12.0ms
(* x 1/6)
9.0ms
(* x 1/6)

simplify6.4s

Counts
54 → 75
Calls
54 calls:
Slowest
616.0ms
(sqrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))
522.0ms
(/ (sqrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3))) 1)
504.0ms
(* (cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3))) (cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3))))
498.0ms
(/ (* (cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3))) (cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))) 1)
376.0ms
(/ (* (* (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)) (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3))) (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3))) (* (* (+ (* x x) (- (* (* (+ (* x 1/6) 1/2) (* x x)) (* (+ (* x 1/6) 1/2) (* x x))) (* x (* (+ (* x 1/6) 1/2) (* x x))))) (+ (* x x) (- (* (* (+ (* x 1/6) 1/2) (* x x)) (* (+ (* x 1/6) 1/2) (* x x))) (* x (* (+ (* x 1/6) 1/2) (* x x)))))) (+ (* x x) (- (* (* (+ (* x 1/6) 1/2) (* x x)) (* (+ (* x 1/6) 1/2) (* x x))) (* x (* (+ (* x 1/6) 1/2) (* x x)))))))

prune905.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0b

localize39.0ms

Local error

Found 4 expressions with local error:

39.7b
(cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))
39.7b
(cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))
39.7b
(cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))
28.7b
(/ (+ (* x x) (- (* (* (+ (* x 1/6) 1/2) (* x x)) (* (+ (* x 1/6) 1/2) (* x x))) (* x (* (+ (* x 1/6) 1/2) (* x x))))) (cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3))))

rewrite163.0ms

Algorithm
rewrite-expression-head
Rules
38×*-un-lft-identity
35×cbrt-prod
24×add-cube-cbrt
24×times-frac
24×add-sqr-sqrt
associate-/r*
cbrt-div
distribute-lft-out
sum-cubes
add-exp-log
flip-+
add-cbrt-cube
flip3-+
add-log-exp
pow1
associate-/l*
pow1/3
associate-/l/
associate-/r/
div-inv
div-exp
div-sub
frac-2neg
associate-+r-
clear-num
cbrt-undiv
Counts
4 → 97
Calls
4 calls:
Slowest
148.0ms
(/ (+ (* x x) (- (* (* (+ (* x 1/6) 1/2) (* x x)) (* (+ (* x 1/6) 1/2) (* x x))) (* x (* (+ (* x 1/6) 1/2) (* x x))))) (cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3))))
5.0ms
(cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))
4.0ms
(cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))
4.0ms
(cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))

series1.1s

Counts
4 → 12
Calls
4 calls:
Slowest
388.0ms
(cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))
305.0ms
(cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))
270.0ms
(cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))
125.0ms
(/ (+ (* x x) (- (* (* (+ (* x 1/6) 1/2) (* x x)) (* (+ (* x 1/6) 1/2) (* x x))) (* x (* (+ (* x 1/6) 1/2) (* x x))))) (cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3))))

simplify19.9s

Counts
98 → 109
Calls
98 calls:
Slowest
863.0ms
(/ (+ (* x x) (* (* (+ (* x 1/6) 1/2) (* x x)) (* (+ (* x 1/6) 1/2) (* x x)))) (cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3))))
855.0ms
(cbrt (- (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))
593.0ms
(/ 1 (sqrt (cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))))
589.0ms
(cbrt (* (cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3))) (cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))))
566.0ms
(cbrt (+ (pow x 3) (pow (* (+ (* x 1/6) 1/2) (* x x)) 3)))

prune1.7s

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0b

regimes91.0ms

Accuracy

0% (0.4b remaining)

Error of 0.4b against oracle of 0.0b and baseline of 0.4b

bsearch1.0ms

end0.0ms

sample2.8s

Algorithm
intervals