Average Error: 57.8 → 0.6
Time: 8.7s
Precision: 64
Internal Precision: 128
\[\frac{e^{x} - e^{-x}}{2}\]
\[\frac{(\left((\frac{1}{3} \cdot \left(x \cdot x\right) + 2)_*\right) \cdot x + \left(\frac{1}{60} \cdot {x}^{5}\right))_*}{2}\]

Error

Bits error versus x

Derivation

  1. Initial program 57.8

    \[\frac{e^{x} - e^{-x}}{2}\]
  2. Taylor expanded around 0 0.6

    \[\leadsto \frac{\color{blue}{2 \cdot x + \left(\frac{1}{3} \cdot {x}^{3} + \frac{1}{60} \cdot {x}^{5}\right)}}{2}\]
  3. Simplified0.6

    \[\leadsto \frac{\color{blue}{(\left((\frac{1}{3} \cdot \left(x \cdot x\right) + 2)_*\right) \cdot x + \left({x}^{5} \cdot \frac{1}{60}\right))_*}}{2}\]
  4. Final simplification0.6

    \[\leadsto \frac{(\left((\frac{1}{3} \cdot \left(x \cdot x\right) + 2)_*\right) \cdot x + \left(\frac{1}{60} \cdot {x}^{5}\right))_*}{2}\]

Reproduce

herbie shell --seed 2019016 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic sine"
  (/ (- (exp x) (exp (- x))) 2))

Details

Time bar (total: 8.3s)Debug log

sample226.0ms

Algorithm
intervals
Results
525×(pre true 80)
280×(body real 80)
105×(body real 1280)
82×(body real 640)
42×(body real 320)
16×(body real 160)

simplify21.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
21.0ms
(/ (- (exp x) (exp (- x))) 2)

prune5.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 57.7b

localize17.0ms

Local error

Found 1 expressions with local error:

6.1b
(- (exp x) (exp (- x)))

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
10×*-un-lft-identity
10×add-sqr-sqrt
prod-diff
add-cube-cbrt
add-log-exp
fma-neg
difference-of-squares
distribute-lft-out--
flip--
log1p-expm1-u
add-exp-log
diff-log
add-cbrt-cube
flip3--
sub-neg
pow1
expm1-log1p-u
Counts
1 → 28
Calls
1 calls:
Slowest
5.0ms
(- (exp x) (exp (- x)))

series52.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
52.0ms
(- (exp x) (exp (- x)))

simplify652.0ms

Counts
27 → 31
Calls
27 calls:
Slowest
63.0ms
(fma 1 (exp x) (- (* (exp (- x)) 1)))
58.0ms
(+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5))))
52.0ms
(fma 1 (exp x) (- (* (cbrt (exp (- x))) (* (cbrt (exp (- x))) (cbrt (exp (- x)))))))
39.0ms
(fma 1 (exp x) (- (* (sqrt (exp (- x))) (sqrt (exp (- x))))))
39.0ms
(fma (- (cbrt (exp (- x)))) (* (cbrt (exp (- x))) (cbrt (exp (- x)))) (* (cbrt (exp (- x))) (* (cbrt (exp (- x))) (cbrt (exp (- x))))))

prune264.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize23.0ms

Local error

Found 3 expressions with local error:

0.1b
(* (pow x 5) 1/60)
0.0b
(fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))
0.0b
(fma 1/3 (* x x) 2)

rewrite3.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
log1p-expm1-u
add-exp-log
associate-*l*
add-cbrt-cube
pow1
expm1-log1p-u
fma-udef
*-commutative
Counts
3 → 33
Calls
3 calls:
Slowest
2.0ms
(* (pow x 5) 1/60)
0.0ms
(fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))
0.0ms
(fma 1/3 (* x x) 2)

series93.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
33.0ms
(fma 1/3 (* x x) 2)
30.0ms
(* (pow x 5) 1/60)
30.0ms
(fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))

simplify300.0ms

Counts
11 → 42
Calls
11 calls:
Slowest
86.0ms
(+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5))))
84.0ms
(+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5))))
84.0ms
(+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5))))
12.0ms
(+ (* 1/3 (pow x 2)) 2)
12.0ms
(+ (* 1/3 (pow x 2)) 2)

prune404.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.0b

localize1.0ms

Local error

Found 1 expressions with local error:

6.1b
(- (exp x) (exp (- x)))

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
10×*-un-lft-identity
10×add-sqr-sqrt
prod-diff
add-cube-cbrt
add-log-exp
fma-neg
difference-of-squares
distribute-lft-out--
flip--
log1p-expm1-u
add-exp-log
diff-log
add-cbrt-cube
flip3--
sub-neg
pow1
expm1-log1p-u
Counts
1 → 28
Calls
1 calls:
Slowest
7.0ms
(- (exp x) (exp (- x)))

series47.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
47.0ms
(- (exp x) (exp (- x)))

simplify627.0ms

Counts
27 → 31
Calls
27 calls:
Slowest
70.0ms
(fma 1 (exp x) (- (* (exp (- x)) 1)))
55.0ms
(+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5))))
43.0ms
(fma (* (cbrt (exp x)) (cbrt (exp x))) (cbrt (exp x)) (- (* (exp (- x)) 1)))
39.0ms
(fma (- (cbrt (exp (- x)))) (* (cbrt (exp (- x))) (cbrt (exp (- x)))) (* (cbrt (exp (- x))) (* (cbrt (exp (- x))) (cbrt (exp (- x))))))
38.0ms
(fma 1 (exp x) (- (* (sqrt (exp (- x))) (sqrt (exp (- x))))))

prune190.0ms

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0.0b

regimes114.0ms

Accuracy

0% (0.6b remaining)

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

bsearch2.0ms

end0.0ms

sample5.3s

Algorithm
intervals
Results
15887×(pre true 80)
8172×(body real 80)
3343×(body real 1280)
2501×(body real 640)
1247×(body real 320)
624×(body real 160)