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

Derivation

  1. Initial program 29.9

    \[\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 2019016 
(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: 11.7s)Debug log

sample122.0ms

Algorithm
intervals
Results
525×(pre true 80)
273×(body real 80)
177×(body real 1280)
43×(body real 640)
23×(body real 320)
(body real 160)

simplify19.0ms

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

prune5.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.0b

localize35.0ms

Local error

Found 2 expressions with local error:

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

rewrite20.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
17.0ms
(+ (- (exp x) 2) (exp (- x)))
3.0ms
(- (exp x) 2)

series111.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
93.0ms
(+ (- (exp x) 2) (exp (- x)))
18.0ms
(- (exp x) 2)

simplify1.3s

Counts
19 → 36
Calls
19 calls:
Slowest
275.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp 0)))
260.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) 1))
228.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) (exp 0)))
149.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) 1))
104.0ms
(* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp x))

prune305.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize22.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
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
0.0b
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))

rewrite15.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
7.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
4.0ms
(* 1/12 (pow x 4))
3.0ms
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
1.0ms
(* 1/360 (pow x 6))

series158.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
57.0ms
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
41.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
34.0ms
(* 1/360 (pow x 6))
26.0ms
(* 1/12 (pow x 4))

simplify231.0ms

Counts
23 → 59
Calls
23 calls:
Slowest
55.0ms
(* (exp (pow x 2)) (* (exp (* 1/12 (pow x 4))) (exp (* 1/360 (pow x 6)))))
32.0ms
(* (exp (pow x 2)) (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
26.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
25.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
20.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))

prune618.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.0b

localize9.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
(+ (pow x 2) (* 1/12 (pow x 4)))
0.0b
(+ (+ (pow x 2) (* 1/12 (pow x 4))) (* 1/360 (pow x 6)))

rewrite20.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
12.0ms
(+ (+ (pow x 2) (* 1/12 (pow x 4))) (* 1/360 (pow x 6)))
5.0ms
(+ (pow x 2) (* 1/12 (pow x 4)))
1.0ms
(* 1/12 (pow x 4))
1.0ms
(* 1/360 (pow x 6))

series129.0ms

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

simplify213.0ms

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

prune592.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 4 expressions with local error:

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

rewrite50.0ms

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

series201.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
97.0ms
(log (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
41.0ms
(+ (pow x 2) (log (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))
36.0ms
(* 1/360 (pow x 6))
27.0ms
(* 1/12 (pow x 4))

simplify481.0ms

Counts
33 → 67
Calls
33 calls:
Slowest
82.0ms
(+ (pow x 2) (log (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))
77.0ms
(+ (pow x 2) (log (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))
61.0ms
(* (exp (pow x 2)) (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
35.0ms
(log (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
26.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))

prune854.0ms

Pruning

5 alts after pruning (2 fresh and 3 done)

Merged error: 0.0b

regimes88.0ms

Accuracy

0% (0.6b remaining)

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

bsearch4.0ms

end0.0ms

sample6.0s

Algorithm
intervals
Results
15887×(pre true 80)
8062×(body real 80)
5620×(body real 1280)
1271×(body real 640)
588×(body real 320)
346×(body real 160)