Average Error: 29.5 → 0.6
Time: 14.0s
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

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

Derivation

  1. Initial program 29.5

    \[\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 2019007 
(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: 13.4s)Debug log

sample140.0ms

Algorithm
intervals

simplify20.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

20.0ms
(+ (- (exp x) 2) (exp (- x)))

prune5.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.6b

localize48.0ms

Local error

Found 2 expressions with local error:

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

rewrite23.0ms

Algorithm
rewrite-expression-head
Counts
2 → 30
Calls

2 calls. Slowest were:

19.0ms
(+ (- (exp x) 2) (exp (- x)))
3.0ms
(- (exp x) 2)

series107.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

92.0ms
(+ (- (exp x) 2) (exp (- x)))
14.0ms
(- (exp x) 2)

simplify1.3s

Counts
19 → 36
Calls

19 calls. Slowest were:

306.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp 0)))
229.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) 1))
170.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) (exp 0)))

prune319.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

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

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 47
Calls

4 calls. Slowest were:

6.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
3.0ms
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
1.0ms
(* 1/12 (pow x 4))

series159.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

83.0ms
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
42.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
19.0ms
(* 1/360 (pow x 6))
15.0ms
(* 1/12 (pow x 4))

simplify223.0ms

Counts
23 → 59
Calls

23 calls. Slowest were:

47.0ms
(* (exp (pow x 2)) (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
41.0ms
(* (exp (pow x 2)) (* (exp (* 1/12 (pow x 4))) (exp (* 1/360 (pow x 6)))))
25.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))

prune692.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 4 expressions with local error:

27.7b
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
27.7b
(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))

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
4 → 52
Calls

4 calls. Slowest were:

15.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
15.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
1.0ms
(* 1/12 (pow x 4))

series158.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

69.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
53.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
21.0ms
(* 1/12 (pow x 4))
16.0ms
(* 1/12 (pow x 4))

simplify1.8s

Counts
32 → 64
Calls

32 calls. Slowest were:

311.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))))
311.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))))))
244.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))))))

prune822.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.0b

localize19.0ms

Local error

Found 4 expressions with local error:

28.6b
(log (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
2.8b
(exp (log (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))
0.1b
(* 1/12 (pow x 4))
0.1b
(* 1/360 (pow x 6))

rewrite27.0ms

Algorithm
rewrite-expression-head
Counts
4 → 55
Calls

4 calls. Slowest were:

12.0ms
(exp (log (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))
9.0ms
(log (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
2.0ms
(* 1/360 (pow x 6))

series189.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

104.0ms
(log (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
41.0ms
(exp (log (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))
26.0ms
(* 1/12 (pow x 4))
19.0ms
(* 1/360 (pow x 6))

simplify1.2s

Counts
36 → 67
Calls

36 calls. Slowest were:

200.0ms
(exp (log (- (* (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)))))))
193.0ms
(- (+ (log 1/360) (* 30 (/ 1 (pow x 2)))) (+ (* 6 (log (/ 1 x))) (* 90 (/ 1 (pow x 4)))))
137.0ms
(log (- (* (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))))))

prune772.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.0b

regimes44.0ms

Accuracy

0% (0.6b remaining)

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

bsearch1.0ms

end0.0ms

sample5.2s

Algorithm
intervals