Average Error: 30.0 → 0.6
Time: 21.4s
Precision: 64
Internal Precision: 128
\[\left(e^{x} - 2\right) + e^{-x}\]
\[{x}^{2} + \left({x}^{6} \cdot \frac{1}{360} + \frac{1}{12} \cdot {x}^{4}\right)\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original30.0
Target0.0
Herbie0.6
\[4 \cdot {\left(\sinh \left(\frac{x}{2}\right)\right)}^{2}\]

Derivation

  1. Initial program 30.0

    \[\left(e^{x} - 2\right) + e^{-x}\]
  2. Taylor expanded around 0 0.6

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

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

Reproduce

herbie shell --seed 2019010 
(FPCore (x)
  :name "exp2 (problem 3.3.7)"

  :herbie-target
  (* 4 (pow (sinh (/ x 2)) 2))

  (+ (- (exp x) 2) (exp (- x))))

Details

Time bar (total: 20.5s)Debug log

sample208.0ms

Algorithm
intervals

simplify40.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
40.0ms
(+ (- (exp x) 2) (exp (- x)))

prune9.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 29.6b

localize15.0ms

Local error

Found 2 expressions with local error:

4.3b
(+ (- (exp x) 2) (exp (- x)))
0.0b
(- (exp x) 2)

rewrite15.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
frac-add
*-un-lft-identity
flip--
flip3--
add-cube-cbrt
add-exp-log
exp-diff
add-cbrt-cube
sub-neg
associate-+l+
pow1
exp-neg
add-sqr-sqrt
neg-sub0
distribute-lft-out
flip-+
associate-+l-
flip3-+
sum-log
+-commutative
Counts
2 → 30
Calls
2 calls:
Slowest
12.0ms
(+ (- (exp x) 2) (exp (- x)))
3.0ms
(- (exp x) 2)

series114.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
99.0ms
(+ (- (exp x) 2) (exp (- x)))
15.0ms
(- (exp x) 2)

simplify1.5s

Counts
19 → 36
Calls
19 calls:
Slowest
351.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp 0)))
285.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) 1))
193.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) 1))
172.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) (exp 0)))
122.0ms
(* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp x))

prune333.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 4 expressions with local error:

0.1b
(* 1/12 (pow x 4))
0.1b
(* 1/360 (pow x 6))
0.0b
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
0.0b
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))

rewrite25.0ms

Algorithm
rewrite-expression-head
Rules
11×add-log-exp
*-un-lft-identity
add-cube-cbrt
associate-*r*
add-sqr-sqrt
add-exp-log
add-cbrt-cube
sum-log
pow1
flip-+
*-commutative
flip3-+
+-commutative
distribute-lft-out
associate-+r+
Counts
4 → 47
Calls
4 calls:
Slowest
13.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
6.0ms
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
2.0ms
(* 1/12 (pow x 4))
2.0ms
(* 1/360 (pow x 6))

series151.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
59.0ms
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
39.0ms
(* 1/360 (pow x 6))
27.0ms
(* 1/12 (pow x 4))
26.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))

simplify253.0ms

Counts
23 → 59
Calls
23 calls:
Slowest
63.0ms
(* (exp (pow x 2)) (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
34.0ms
(* (exp (pow x 2)) (* (exp (* 1/12 (pow x 4))) (exp (* 1/360 (pow x 6)))))
26.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
25.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
17.0ms
(* (exp (* 1/12 (pow x 4))) (exp (* 1/360 (pow x 6))))

prune739.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 4 expressions with local error:

29.1b
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
29.1b
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
0.1b
(* 1/12 (pow x 4))
0.1b
(* 1/12 (pow x 4))

rewrite25.0ms

Algorithm
rewrite-expression-head
Rules
12×*-un-lft-identity
10×add-sqr-sqrt
sqrt-prod
add-cube-cbrt
associate-*r*
add-log-exp
add-exp-log
sqrt-div
add-cbrt-cube
pow1
distribute-lft-out
flip-+
*-commutative
pow1/2
flip3-+
rem-sqrt-square
Counts
4 → 52
Calls
4 calls:
Slowest
12.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
8.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
2.0ms
(* 1/12 (pow x 4))
2.0ms
(* 1/12 (pow x 4))

series176.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
75.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
64.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
23.0ms
(* 1/12 (pow x 4))
15.0ms
(* 1/12 (pow x 4))

simplify1.8s

Counts
32 → 64
Calls
32 calls:
Slowest
277.0ms
(- (+ (* 1/2 (/ 1 (* (sqrt 1/360) x))) (+ (* (sqrt 1/360) (pow x 3)) (* 1/24 (/ x (sqrt 1/360))))) (* 1/1152 (/ 1 (* (pow (sqrt 1/360) 3) x))))
277.0ms
(- (* 1/1152 (/ 1 (* (pow (sqrt 1/360) 3) x))) (+ (* 1/2 (/ 1 (* (sqrt 1/360) x))) (+ (* (sqrt 1/360) (pow x 3)) (* 1/24 (/ x (sqrt 1/360))))))
259.0ms
(- (+ (* 1/2 (/ 1 (* (sqrt 1/360) x))) (+ (* (sqrt 1/360) (pow x 3)) (* 1/24 (/ x (sqrt 1/360))))) (* 1/1152 (/ 1 (* (pow (sqrt 1/360) 3) x))))
231.0ms
(- (* 1/1152 (/ 1 (* (pow (sqrt 1/360) 3) x))) (+ (* 1/2 (/ 1 (* (sqrt 1/360) x))) (+ (* (sqrt 1/360) (pow x 3)) (* 1/24 (/ x (sqrt 1/360))))))
209.0ms
(sqrt (- (* (pow x 2) (pow x 2)) (* (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))

prune888.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize9.0ms

Local error

Found 4 expressions with local error:

29.1b
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
29.1b
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
29.1b
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
0.5b
(* (sqrt (sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))) (sqrt (sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))))

rewrite51.0ms

Algorithm
rewrite-expression-head
Rules
34×sqrt-prod
30×sqrt-div
23×*-un-lft-identity
16×add-sqr-sqrt
13×add-cube-cbrt
10×associate-*l*
10×associate-*r*
flip-+
flip3-+
pow1
pow1/2
add-exp-log
add-cbrt-cube
distribute-lft-out
add-log-exp
frac-times
rem-sqrt-square
pow-prod-up
associate-*r/
associate-*l/
pow-prod-down
cbrt-unprod
*-commutative
prod-exp
sqrt-unprod
pow-plus
rem-square-sqrt
pow2
Counts
4 → 91
Calls
4 calls:
Slowest
27.0ms
(* (sqrt (sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))) (sqrt (sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))))
8.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
8.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
7.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))

series218.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
69.0ms
(* (sqrt (sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))) (sqrt (sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))))
56.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
49.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
43.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))

simplify6.7s

Counts
75 → 103
Calls
75 calls:
Slowest
478.0ms
(* (sqrt (sqrt (- (* (pow x 2) (pow x 2)) (* (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))) (sqrt (sqrt (+ (pow (pow x 2) 3) (pow (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))) 3)))))
407.0ms
(* (sqrt (sqrt (+ (* (pow x 2) (pow x 2)) (- (* (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))) (* (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))))) (sqrt (sqrt (+ (* (pow x 2) (pow x 2)) (- (* (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))) (* (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))))))
372.0ms
(* (sqrt (sqrt (+ (pow (pow x 2) 3) (pow (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))) 3)))) (sqrt (sqrt (- (* (pow x 2) (pow x 2)) (* (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))))
365.0ms
(sqrt (sqrt (+ (* (pow x 2) (pow x 2)) (- (* (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))) (* (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))))
319.0ms
(- (+ (* 1/2 (/ 1 (* (sqrt 1/360) x))) (+ (* (sqrt 1/360) (pow x 3)) (* 1/24 (/ x (sqrt 1/360))))) (* 1/1152 (/ 1 (* (pow (sqrt 1/360) 3) x))))

prune1.7s

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

regimes37.0ms

Accuracy

0% (0.0b remaining)

Error of 0.6b against oracle of 0.6b and baseline of 0.6b

bsearch2.0ms

end0.0ms

sample5.4s

Algorithm
intervals