Average Error: 29.3 → 0.7
Time: 18.7s
Precision: 64
Internal Precision: 128
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\frac{1}{360} \cdot {x}^{6} + \left({x}^{2} + \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.3
Target0.0
Herbie0.7
\[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. 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. Using strategy rm
  4. Applied associate-+r+0.7

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

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

Reproduce

herbie shell --seed 1042149663 
(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

sample263.0ms

Algorithm
intervals
Results
528×(pre true 80)
277×(body real 80)
177×(body real 1280)
44×(body real 640)
17×(body real 320)
13×(body real 160)

simplify45.0ms

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

prune11.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.1b

localize34.0ms

Local error

Found 2 expressions with local error:

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

rewrite36.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
29.0ms
(+ (- (exp x) 2) (exp (- x)))
6.0ms
(- (exp x) 2)

series150.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
134.0ms
(+ (- (exp x) 2) (exp (- x)))
16.0ms
(- (exp x) 2)

simplify2.1s

Counts
19 → 36
Calls
19 calls:
Slowest
461.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp 0)))
445.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) 1))
316.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) (exp 0)))
214.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))

prune510.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize53.0ms

Local error

Found 4 expressions with local error:

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

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

series231.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
105.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))))
45.0ms
(* 1/360 (pow x 6))
32.0ms
(* 1/12 (pow x 4))

simplify356.0ms

Counts
23 → 59
Calls
23 calls:
Slowest
73.0ms
(* (exp (pow x 2)) (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
70.0ms
(* (exp (pow x 2)) (* (exp (* 1/12 (pow x 4))) (exp (* 1/360 (pow x 6)))))
32.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
30.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
30.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))

prune1.0s

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0b

localize15.0ms

Local error

Found 4 expressions with local error:

0.1b
(* 1/12 (pow x 4))
0.1b
(* 1/360 (pow x 6))
0.0b
(+ (pow x 2) (* 1/12 (pow x 4)))
0.0b
(+ (+ (pow x 2) (* 1/12 (pow x 4))) (* 1/360 (pow x 6)))

rewrite41.0ms

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

series208.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
76.0ms
(+ (pow x 2) (* 1/12 (pow x 4)))
50.0ms
(* 1/360 (pow x 6))
50.0ms
(+ (+ (pow x 2) (* 1/12 (pow x 4))) (* 1/360 (pow x 6)))
33.0ms
(* 1/12 (pow x 4))

simplify316.0ms

Counts
22 → 58
Calls
22 calls:
Slowest
72.0ms
(* (* (exp (pow x 2)) (exp (* 1/12 (pow x 4)))) (exp (* 1/360 (pow x 6))))
71.0ms
(* (exp (+ (pow x 2) (* 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))))
30.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
30.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))

prune991.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize19.0ms

Local error

Found 4 expressions with local error:

29.3b
(log (+ (+ (pow x 2) (* 1/12 (pow x 4))) (* 1/360 (pow x 6))))
2.8b
(exp (log (+ (+ (pow x 2) (* 1/12 (pow x 4))) (* 1/360 (pow x 6)))))
0.1b
(* 1/12 (pow x 4))
0.1b
(* 1/360 (pow x 6))

rewrite44.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
associate-*r*
log-prod
pow1
add-exp-log
add-log-exp
add-cbrt-cube
exp-prod
log-div
exp-sum
flip-+
*-commutative
log-pow
exp-diff
flip3-+
rem-exp-log
rem-log-exp
Counts
4 → 53
Calls
4 calls:
Slowest
22.0ms
(exp (log (+ (+ (pow x 2) (* 1/12 (pow x 4))) (* 1/360 (pow x 6)))))
16.0ms
(log (+ (+ (pow x 2) (* 1/12 (pow x 4))) (* 1/360 (pow x 6))))
3.0ms
(* 1/12 (pow x 4))
3.0ms
(* 1/360 (pow x 6))

series266.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
144.0ms
(log (+ (+ (pow x 2) (* 1/12 (pow x 4))) (* 1/360 (pow x 6))))
49.0ms
(exp (log (+ (+ (pow x 2) (* 1/12 (pow x 4))) (* 1/360 (pow x 6)))))
40.0ms
(* 1/360 (pow x 6))
32.0ms
(* 1/12 (pow x 4))

simplify2.1s

Counts
34 → 65
Calls
34 calls:
Slowest
374.0ms
(- (+ (log 1/360) (* 30 (/ 1 (pow x 2)))) (+ (* 6 (log (/ 1 x))) (* 90 (/ 1 (pow x 4)))))
283.0ms
(exp (log (- (* (+ (pow x 2) (* 1/12 (pow x 4))) (+ (pow x 2) (* 1/12 (pow x 4)))) (* (* 1/360 (pow x 6)) (* 1/360 (pow x 6))))))
282.0ms
(log (- (* (+ (pow x 2) (* 1/12 (pow x 4))) (+ (pow x 2) (* 1/12 (pow x 4)))) (* (* 1/360 (pow x 6)) (* 1/360 (pow x 6)))))
268.0ms
(- (+ (log 1/360) (* 30 (/ 1 (pow x 2)))) (+ (* 6 (log (/ -1 x))) (* 90 (/ 1 (pow x 4)))))
206.0ms
(log (+ (pow (+ (pow x 2) (* 1/12 (pow x 4))) 3) (pow (* 1/360 (pow x 6)) 3)))

prune1.2s

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

regimes107.0ms

Accuracy

0% (0.6b remaining)

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

bsearch3.0ms

end0.0ms

sample7.6s

Algorithm
intervals
Results
15917×(pre true 80)
8086×(body real 80)
5686×(body real 1280)
1254×(body real 640)
589×(body real 320)
302×(body real 160)