Average Error: 30.0 → 0.6
Time: 16.3s
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

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. Initial simplification30.0

    \[\leadsto \left(e^{x} - 2\right) - \frac{-1}{e^{x}}\]
  3. 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)}\]
  4. 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))_*}\]
  5. 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 2018360 +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: 9.2s)Debug log

start205.0ms

Algorithm
intervals

setup79.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 28.7b

localize19.0ms

Local error

Found 3 expressions with local error:

5.6b
(- (- (exp x) 2) (/ -1 (exp x)))
0.0b
(- (exp x) 2)
0.0b
(/ -1 (exp x))

rewrite47.0ms

Algorithm
rewrite-expression-head
Counts
3 → 67
Calls

3 calls. Slowest were:

38.0ms
(- (- (exp x) 2) (/ -1 (exp x)))
6.0ms
(- (exp x) 2)
1.0ms
(/ -1 (exp x))

series141.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

111.0ms
(- (- (exp x) 2) (/ -1 (exp x)))
16.0ms
(/ -1 (exp x))
14.0ms
(- (exp x) 2)

simplify2.9s

Counts
51 → 76
Calls

51 calls. Slowest were:

724.0ms
(- (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) -1))
723.0ms
(- (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) -1))
122.0ms
(* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp x))

prune770.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 1 expressions with local error:

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

rewrite0.0ms

Algorithm
rewrite-expression-head
Counts
1 → 10
Calls

1 calls. Slowest were:

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

series26.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

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

simplify66.0ms

Counts
3 → 13
Calls

3 calls. Slowest were:

30.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
21.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))))

prune209.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:

30.7b
(log (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
2.8b
(exp (log (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
3 → 41
Calls

3 calls. Slowest were:

4.0ms
(exp (log (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))))
2.0ms
(log (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
0.0ms
(fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))

series166.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

95.0ms
(log (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
37.0ms
(fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))
34.0ms
(exp (log (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))))

simplify963.0ms

Counts
20 → 50
Calls

20 calls. Slowest were:

330.0ms
(- (+ (log 1/360) (* 30 (/ 1 (pow x 2)))) (+ (* 6 (log (/ 1 x))) (* 90 (/ 1 (pow x 4)))))
246.0ms
(- (+ (log 1/360) (* 30 (/ 1 (pow x 2)))) (+ (* 6 (log (/ -1 x))) (* 90 (/ 1 (pow x 4)))))
78.0ms
(- (+ (* 1/12 (pow x 2)) (* 2 (log x))) (* 1/1440 (pow x 4)))

prune836.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize16.0ms

Local error

Found 3 expressions with local error:

30.7b
(log (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
2.8b
(pow E (log (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)))

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
3 → 41
Calls

3 calls. Slowest were:

3.0ms
(pow E (log (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))))
2.0ms
(log (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
0.0ms
(fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))

series309.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

172.0ms
(pow E (log (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))))
109.0ms
(log (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
28.0ms
(fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))

simplify1.5s

Counts
20 → 50
Calls

20 calls. Slowest were:

414.0ms
(- (+ (log 1/360) (* 30 (/ 1 (pow x 2)))) (+ (* 6 (log (/ 1 x))) (* 90 (/ 1 (pow x 4)))))
245.0ms
(+ (* 30 (/ (exp (- (log 1/360) (* 6 (log (/ 1 x))))) (pow x 2))) (+ (exp (- (log 1/360) (* 6 (log (/ 1 x))))) (* 360 (/ (exp (- (log 1/360) (* 6 (log (/ 1 x))))) (pow x 4)))))
196.0ms
(- (+ (log 1/360) (* 30 (/ 1 (pow x 2)))) (+ (* 6 (log (/ -1 x))) (* 90 (/ 1 (pow x 4)))))

prune816.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

regimes56.0ms

Accuracy

0% (0.5b remaining)

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

bsearch1.0ms