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

Error

Bits error versus x

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. Simplified0.6

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

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

Reproduce

herbie shell --seed 2019007 +o rules:numerics
(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: 16.4s)Debug log

sample162.0ms

Algorithm
intervals

simplify62.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune5.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.6b

localize13.0ms

Local error

Found 2 expressions with local error:

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

rewrite24.0ms

Algorithm
rewrite-expression-head
Counts
2 → 40
Calls

2 calls. Slowest were:

17.0ms
(+ (- (exp x) 2) (exp (- x)))
6.0ms
(- (exp x) 2)

series97.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

88.0ms
(+ (- (exp x) 2) (exp (- x)))
8.0ms
(- (exp x) 2)

simplify1.6s

Counts
23 → 46
Calls

23 calls. Slowest were:

441.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp 0)))
264.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) (exp 0)))
187.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) 1))

prune311.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize27.0ms

Local error

Found 2 expressions with local error:

0.0b
(fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))
0.0b
(fma 1/360 (pow x 6) (* x x))

rewrite1.0ms

Algorithm
rewrite-expression-head
Counts
2 → 20
Calls

2 calls. Slowest were:

0.0ms
(fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))
0.0ms
(fma 1/360 (pow x 6) (* x x))

series85.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

59.0ms
(fma 1/360 (pow x 6) (* x x))
26.0ms
(fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))

simplify67.0ms

Counts
6 → 26
Calls

6 calls. Slowest were:

15.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
14.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
13.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))

prune267.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 4 expressions with local error:

27.7b
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
27.7b
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
0.0b
(* (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))) (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))))
0.0b
(fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))

rewrite7.0ms

Algorithm
rewrite-expression-head
Counts
4 → 70
Calls

4 calls. Slowest were:

5.0ms
(* (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))) (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))))
1.0ms
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
1.0ms
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))

series180.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

71.0ms
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
49.0ms
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
34.0ms
(* (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))) (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))))
25.0ms
(fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))

simplify3.1s

Counts
42 → 82
Calls

42 calls. Slowest were:

493.0ms
(* (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))) (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
395.0ms
(* (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))) (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
353.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.1s

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize16.0ms

Local error

Found 4 expressions with local error:

28.6b
(log (* (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))) (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))))
27.7b
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
27.7b
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
2.8b
(exp (log (* (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))) (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))))))

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
4 → 68
Calls

4 calls. Slowest were:

18.0ms
(exp (log (* (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))) (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))))))
11.0ms
(log (* (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))) (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))))
2.0ms
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))

series249.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

97.0ms
(log (* (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))) (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))))
62.0ms
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
59.0ms
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
31.0ms
(exp (log (* (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))) (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))))))

simplify2.1s

Counts
38 → 80
Calls

38 calls. Slowest were:

343.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))))
312.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))))
283.0ms
(- (+ (log 1/360) (* 30 (/ 1 (pow x 2)))) (+ (* 6 (log (/ -1 x))) (* 90 (/ 1 (pow x 4)))))

prune1.2s

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

regimes30.0ms

Accuracy

0% (0.5b remaining)

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

bsearch1.0ms

end0.0ms

sample5.7s

Algorithm
intervals