Average Error: 29.0 → 0.7
Time: 18.5s
Precision: 64
Internal Precision: 128
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\sqrt{(\frac{1}{12} \cdot \left({x}^{4}\right) + \left((\frac{1}{360} \cdot \left({x}^{6}\right) + \left(x \cdot x\right))_*\right))_*} \cdot \sqrt{(\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.0
Target0.0
Herbie0.7
\[4 \cdot {\left(\sinh \left(\frac{x}{2}\right)\right)}^{2}\]

Derivation

  1. Initial program 29.0

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

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

    \[\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. Using strategy rm
  5. Applied add-sqr-sqrt0.7

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

    \[\leadsto \sqrt{(\frac{1}{12} \cdot \left({x}^{4}\right) + \left((\frac{1}{360} \cdot \left({x}^{6}\right) + \left(x \cdot x\right))_*\right))_*} \cdot \sqrt{(\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 2019008 +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: 17.8s)Debug log

sample196.0ms

Algorithm
intervals

simplify30.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune8.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 32.3b

localize45.0ms

Local error

Found 2 expressions with local error:

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

rewrite20.0ms

Algorithm
rewrite-expression-head
Counts
2 → 40
Calls

2 calls. Slowest were:

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

series86.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

77.0ms
(+ (- (exp x) 2) (exp (- x)))
9.0ms
(- (exp x) 2)

simplify1.4s

Counts
23 → 46
Calls

23 calls. Slowest were:

324.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp 0)))
224.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) (exp 0)))
223.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) 1))

prune371.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

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

series97.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

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

simplify94.0ms

Counts
6 → 26
Calls

6 calls. Slowest were:

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

prune255.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 4 expressions with local error:

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

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 70
Calls

4 calls. Slowest were:

8.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)))))
2.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))))

series181.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

69.0ms
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
64.0ms
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
24.0ms
(fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x)))
24.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)))))

simplify2.8s

Counts
42 → 82
Calls

42 calls. Slowest were:

431.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))))
407.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))))
304.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.0s

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize11.0ms

Local error

Found 4 expressions with local error:

26.0b
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
26.0b
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
26.0b
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
0.5b
(* (sqrt (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))) (sqrt (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))))

rewrite10.0ms

Algorithm
rewrite-expression-head
Counts
4 → 80
Calls

4 calls. Slowest were:

6.0ms
(* (sqrt (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))) (sqrt (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))))

series171.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

45.0ms
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
43.0ms
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))
41.0ms
(* (sqrt (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))) (sqrt (sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))))
41.0ms
(sqrt (fma 1/12 (pow x 4) (fma 1/360 (pow x 6) (* x x))))

simplify3.4s

Counts
52 → 92
Calls

52 calls. Slowest were:

378.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))))
356.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))))
347.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.5s

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

regimes37.0ms

Accuracy

0% (0.6b remaining)

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

bsearch1.0ms

end0.0ms

sample6.1s

Algorithm
intervals