Average Error: 29.3 → 0.6
Time: 21.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

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

Derivation

  1. Initial program 29.3

    \[\left(e^{x} - 2\right) + e^{-x}\]
  2. Initial simplification29.3

    \[\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 2018365 +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: 13.8s)Debug log

start206.0ms

Algorithm
intervals

setup59.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 27.9b

localize23.0ms

Local error

Found 3 expressions with local error:

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

rewrite57.0ms

Algorithm
rewrite-expression-head
Counts
3 → 67
Calls

3 calls. Slowest were:

53.0ms
(- (- (exp x) 2) (/ -1 (exp x)))
3.0ms
(- (exp x) 2)
0.0ms
(/ -1 (exp x))

series98.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

78.0ms
(- (- (exp x) 2) (/ -1 (exp x)))
11.0ms
(- (exp x) 2)
9.0ms
(/ -1 (exp x))

simplify2.0s

Counts
51 → 76
Calls

51 calls. Slowest were:

415.0ms
(- (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) -1))
120.0ms
(* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp x))
119.0ms
(- (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) -1))

prune725.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

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

series94.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

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

simplify64.0ms

Counts
6 → 26
Calls

6 calls. Slowest were:

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

prune416.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize12.0ms

Local error

Found 4 expressions with local error:

31.3b
(log (fma 1/360 (pow x 6) (* x x)))
2.6b
(exp (log (fma 1/360 (pow x 6) (* x x))))
0.0b
(fma 1/12 (pow x 4) (exp (log (fma 1/360 (pow x 6) (* x x)))))
0.0b
(fma 1/360 (pow x 6) (* x x))

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
4 → 51
Calls

4 calls. Slowest were:

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

series679.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

491.0ms
(log (fma 1/360 (pow x 6) (* x x)))
89.0ms
(fma 1/360 (pow x 6) (* x x))
72.0ms
(exp (log (fma 1/360 (pow x 6) (* x x))))
26.0ms
(fma 1/12 (pow x 4) (exp (log (fma 1/360 (pow x 6) (* x x)))))

simplify811.0ms

Counts
23 → 63
Calls

23 calls. Slowest were:

312.0ms
(- (+ (log 1/360) (* 360 (/ 1 (pow x 4)))) (+ (* 6 (log (/ 1 x))) (* 64800 (/ 1 (pow x 8)))))
281.0ms
(- (+ (log 1/360) (* 360 (/ 1 (pow x 4)))) (+ (* 6 (log (/ -1 x))) (* 64800 (/ 1 (pow x 8)))))
48.0ms
(- (+ (* 1/360 (pow x 4)) (* 2 (log x))) (* 1/259200 (pow x 8)))

prune1.1s

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

localize13.0ms

Local error

Found 4 expressions with local error:

31.3b
(log (fma 1/360 (pow x 6) (* x x)))
2.9b
(pow E (log (fma 1/360 (pow x 6) (* x x))))
0.0b
(fma 1/12 (pow x 4) (pow E (log (fma 1/360 (pow x 6) (* x x)))))
0.0b
(fma 1/360 (pow x 6) (* x x))

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
4 → 51
Calls

4 calls. Slowest were:

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

series3.9s

Counts
4 → 12
Calls

4 calls. Slowest were:

2.4s
(pow E (log (fma 1/360 (pow x 6) (* x x))))
925.0ms
(fma 1/12 (pow x 4) (pow E (log (fma 1/360 (pow x 6) (* x x)))))
509.0ms
(log (fma 1/360 (pow x 6) (* x x)))
68.0ms
(fma 1/360 (pow x 6) (* x x))

simplify2.2s

Counts
23 → 63
Calls

23 calls. Slowest were:

553.0ms
(+ (exp (- (log 1/360) (* 6 (log (/ 1 x))))) (+ (* 1/12 (pow x 4)) (* 360 (/ (exp (- (log 1/360) (* 6 (log (/ 1 x))))) (pow x 4)))))
364.0ms
(+ (exp (- (log 1/360) (* 6 (log (/ -1 x))))) (+ (* 1/12 (pow x 4)) (* 360 (/ (exp (- (log 1/360) (* 6 (log (/ -1 x))))) (pow x 4)))))
360.0ms
(+ (exp (- (log 1/360) (* 6 (log (/ 1 x))))) (* 360 (/ (exp (- (log 1/360) (* 6 (log (/ 1 x))))) (pow x 4))))

prune1.1s

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.0b

regimes49.0ms

Accuracy

0% (0.5b remaining)

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

bsearch1.0ms