Average Error: 40.7 → 0.0
Time: 4.1s
Precision: 64
Internal Precision: 128
\[\frac{e^{x} - 1}{x}\]
\[\frac{(e^{x} - 1)^*}{x}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original40.7
Target39.8
Herbie0.0
\[\begin{array}{l} \mathbf{if}\;x \lt 1 \land x \gt -1:\\ \;\;\;\;\frac{e^{x} - 1}{\log \left(e^{x}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x} - 1}{x}\\ \end{array}\]

Derivation

  1. Initial program 40.7

    \[\frac{e^{x} - 1}{x}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\frac{(e^{x} - 1)^*}{x}}\]
  3. Final simplification0.0

    \[\leadsto \frac{(e^{x} - 1)^*}{x}\]

Reproduce

herbie shell --seed 2019010 +o rules:numerics
(FPCore (x)
  :name "Kahan's exp quotient"

  :herbie-target
  (if (and (< x 1) (> x -1)) (/ (- (exp x) 1) (log (exp x))) (/ (- (exp x) 1) x))

  (/ (- (exp x) 1) x))

Details

Time bar (total: 3.8s)Debug log

sample50.0ms

Algorithm
intervals

simplify7.0ms

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

prune14.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 1 expressions with local error:

0.0b
(/ (expm1 x) x)

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
associate-/l*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
expm1-udef
div-inv
log1p-expm1-u
add-exp-log
div-sub
add-cbrt-cube
frac-2neg
clear-num
pow1
expm1-log1p-u
Counts
1 → 16
Calls
1 calls:
Slowest
5.0ms
(/ (expm1 x) x)

series36.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
36.0ms
(/ (expm1 x) x)

simplify122.0ms

Counts
6 → 19
Calls
6 calls:
Slowest
70.0ms
(* -1 (/ (- 1 (exp x)) x))
37.0ms
(+ (* 1/2 x) (+ (* 1/6 (pow x 2)) 1))
9.0ms
(/ (- (exp x) 1) x)
1.0ms
(* (cbrt (expm1 x)) (cbrt (expm1 x)))
1.0ms
(/ (exp x) x)

prune86.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize8.0ms

Local error

Found 2 expressions with local error:

0.0b
(/ 1 (/ x (expm1 x)))
0.0b
(/ x (expm1 x))

rewrite3.0ms

Algorithm
rewrite-expression-head
Rules
associate-/r*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
div-inv
add-exp-log
pow1
add-log-exp
log1p-expm1-u
add-cbrt-cube
frac-2neg
clear-num
expm1-log1p-u
inv-pow
pow-flip
associate-/r/
rec-exp
Counts
2 → 35
Calls
2 calls:
Slowest
1.0ms
(/ 1 (/ x (expm1 x)))
1.0ms
(/ x (expm1 x))

series58.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
29.0ms
(/ 1 (/ x (expm1 x)))
29.0ms
(/ x (expm1 x))

simplify245.0ms

Counts
15 → 41
Calls
15 calls:
Slowest
93.0ms
(* -1 (/ (- 1 (exp x)) x))
89.0ms
(- (+ (* 1/12 (pow x 2)) 1) (* 1/2 x))
33.0ms
(+ (* 1/2 x) (+ (* 1/6 (pow x 2)) 1))
8.0ms
(/ (- (exp x) 1) x)
5.0ms
(/ x (- (exp x) 1))

prune300.0ms

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes15.0ms

Accuracy

0% (0.0b remaining)

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

bsearch0.0ms

end0.0ms

sample2.8s

Algorithm
intervals