Average Error: 29.7 → 0.6
Time: 1.8m
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.7
Target0.0
Herbie0.6
\[4 \cdot {\left(\sinh \left(\frac{x}{2}\right)\right)}^{2}\]

Derivation

  1. Initial program 29.7

    \[\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 1137770271 
(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: 1.7m)Debug log

sample242.0ms

Algorithm
intervals
Results
180×144.0ms(body real 1280)
248×22.0ms(body real 80)
40×20.0ms(body real 640)
502×11.0ms(pre true 80)
23×8.0ms(body real 320)
11×2.0ms(body real 160)

simplify42.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
42.0ms
(+ (- (exp x) 2) (exp (- x)))

prune37.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 28.6b

localize36.0ms

Local error

Found 2 expressions with local error:

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

rewrite44.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
frac-add
*-un-lft-identity
flip--
flip3--
add-cube-cbrt
add-exp-log
exp-diff
add-cbrt-cube
sub-neg
associate-+l+
pow1
exp-neg
add-sqr-sqrt
neg-sub0
distribute-lft-out
flip-+
associate-+l-
flip3-+
sum-log
+-commutative
Counts
2 → 30
Calls
2 calls:
Slowest
36.0ms
(+ (- (exp x) 2) (exp (- x)))
7.0ms
(- (exp x) 2)

series154.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
137.0ms
(+ (- (exp x) 2) (exp (- x)))
17.0ms
(- (exp x) 2)

simplify2.1s

Counts
19 → 36
Calls
19 calls:
Slowest
457.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp 0)))
439.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) 1))
313.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) (exp 0)))
211.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) 1))
139.0ms
(* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp x))

prune552.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize74.0ms

Local error

Found 4 expressions with local error:

0.1b
(* 1/12 (pow x 4))
0.0b
(* 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))))

rewrite31.0ms

Algorithm
rewrite-expression-head
Rules
11×add-log-exp
*-un-lft-identity
add-cube-cbrt
associate-*r*
add-sqr-sqrt
add-exp-log
add-cbrt-cube
sum-log
pow1
flip-+
*-commutative
flip3-+
+-commutative
distribute-lft-out
associate-+r+
Counts
4 → 47
Calls
4 calls:
Slowest
16.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
8.0ms
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
3.0ms
(* 1/12 (pow x 4))
3.0ms
(* 1/360 (pow x 6))

series240.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
114.0ms
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
49.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
43.0ms
(* 1/360 (pow x 6))
34.0ms
(* 1/12 (pow x 4))

simplify340.0ms

Counts
23 → 59
Calls
23 calls:
Slowest
70.0ms
(* (exp (pow x 2)) (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
68.0ms
(* (exp (pow x 2)) (* (exp (* 1/12 (pow x 4))) (exp (* 1/360 (pow x 6)))))
30.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
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))))

prune1.1s

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize29.0ms

Local error

Found 4 expressions with local error:

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

rewrite141.0ms

Algorithm
rewrite-expression-head
Rules
33×flip-+
33×flip3-+
32×frac-times
26×cbrt-div
16×associate-*l/
12×*-un-lft-identity
10×associate-*r/
10×associate-*r*
pow1
add-cube-cbrt
add-sqr-sqrt
add-exp-log
add-cbrt-cube
add-log-exp
associate-*l*
*-commutative
distribute-lft-out
cbrt-unprod
rem-cbrt-cube
pow-prod-up
prod-exp
pow-prod-down
pow3
pow1/3
pow-plus
distribute-lft-in
distribute-rgt-in
pow2
cbrt-prod
Counts
4 → 90
Calls
4 calls:
Slowest
82.0ms
(cbrt (* (* (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))) (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))) (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))
49.0ms
(* (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))) (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
3.0ms
(* 1/12 (pow x 4))
3.0ms
(* 1/12 (pow x 4))

series182.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
59.0ms
(* (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))) (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
56.0ms
(cbrt (* (* (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))) (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))) (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))
34.0ms
(* 1/12 (pow x 4))
34.0ms
(* 1/12 (pow x 4))

simplify14.6s

Counts
72 → 102
Calls
72 calls:
Slowest
798.0ms
(* (- (* (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))))) (- (* (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))))))
771.0ms
(* (+ (pow (pow x 2) 3) (pow (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))) 3)) (+ (pow (pow x 2) 3) (pow (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))) 3)))
732.0ms
(* (+ (pow (pow x 2) 3) (pow (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))) 3)) (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
613.0ms
(* (- (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))) (- (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
526.0ms
(+ (* (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)))) (* (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))

prune2.7s

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

localize44.0ms

Local error

Found 4 expressions with local error:

3.6b
(- (* (- (exp x) 2) (- (exp x) 2)) (* (exp (- x)) (exp (- x))))
0.0b
(* (- (exp x) 2) (- (exp x) 2))
0.0b
(* (exp (- x)) (exp (- x)))
0.0b
(- (- (exp x) 2) (exp (- x)))

rewrite163.0ms

Algorithm
rewrite-expression-head
Rules
76×frac-sub
76×frac-times
65×exp-neg
64×flip--
64×flip3--
56×exp-diff
56×neg-sub0
38×associate-*r/
38×associate-*l/
16×exp-prod
14×*-un-lft-identity
14×pow1
14×add-sqr-sqrt
12×add-cube-cbrt
un-div-inv
add-log-exp
add-cbrt-cube
sub-neg
pow-prod-up
add-exp-log
associate--l+
pow-prod-down
associate-*l*
associate-*r*
distribute-lft-in
neg-mul-1
distribute-rgt-in
difference-of-squares
cbrt-unprod
*-commutative
prod-exp
diff-log
pow-plus
pow2
distribute-lft-out--
associate--l-
Counts
4 → 179
Calls
4 calls:
Slowest
49.0ms
(- (* (- (exp x) 2) (- (exp x) 2)) (* (exp (- x)) (exp (- x))))
42.0ms
(- (- (exp x) 2) (exp (- x)))
32.0ms
(* (- (exp x) 2) (- (exp x) 2))
30.0ms
(* (exp (- x)) (exp (- x)))

series251.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
141.0ms
(- (* (- (exp x) 2) (- (exp x) 2)) (* (exp (- x)) (exp (- x))))
47.0ms
(- (- (exp x) 2) (exp (- x)))
38.0ms
(* (- (exp x) 2) (- (exp x) 2))
25.0ms
(* (exp (- x)) (exp (- x)))

simplify1.2m

Counts
244 → 191
Calls
244 calls:
Slowest
1.2s
(* (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2)))) (* (exp x) (exp x)))
1.0s
(- (* (* (- (* (exp x) (exp x)) (* 2 2)) (- (* (exp x) (exp x)) (* 2 2))) (exp x)) (* (* (+ (exp x) 2) (+ (exp x) 2)) (* (exp (- x)) (exp 0))))
995.0ms
(- (* (* (- (* (exp x) (exp x)) (* 2 2)) (- (* (exp x) (exp x)) (* 2 2))) (exp x)) (* (* (+ (exp x) 2) (+ (exp x) 2)) (* (exp (- x)) 1)))
955.0ms
(- (* (* (- (exp x) 2) (- (* (exp x) (exp x)) (* 2 2))) (* (exp x) (exp x))) (* (+ (exp x) 2) (* 1 1)))
954.0ms
(- (* (* (- (* (exp x) (exp x)) (* 2 2)) (- (exp x) 2)) (* (exp x) (exp x))) (* (+ (exp x) 2) (* 1 1)))

prune3.9s

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

regimes59.0ms

Accuracy

0% (0.4b remaining)

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

bsearch3.0ms

end0.0ms

sample7.8s

Algorithm
intervals
Results
5656×5.3s(body real 1280)
8219×813.0ms(body real 80)
1242×709.0ms(body real 640)
16060×336.0ms(pre true 80)
620×254.0ms(body real 320)
323×71.0ms(body real 160)