Average Error: 39.6 → 0.0
Time: 20.3s
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

Original39.6
Target38.7
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 39.6

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

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

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

Reproduce

herbie shell --seed 2018365 +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: 15.4s)Debug log

start102.0ms

Algorithm
intervals

setup42.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.0b

localize5.0ms

Local error

Found 1 expressions with local error:

0.0b
(/ (expm1 x) x)

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
1 → 16
Calls

1 calls. Slowest were:

3.0ms
(/ (expm1 x) x)

series39.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

39.0ms
(/ (expm1 x) x)

simplify196.0ms

Counts
6 → 19
Calls

6 calls. Slowest were:

98.0ms
(* -1 (/ (- 1 (exp x)) x))
73.0ms
(+ (* 1/2 x) (+ (* 1/6 (pow x 2)) 1))
20.0ms
(/ (- (exp x) 1) x)

prune179.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0b

localize11.0ms

Local error

Found 2 expressions with local error:

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

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
2 → 35
Calls

2 calls. Slowest were:

1.0ms
(/ 1 (/ x (expm1 x)))
1.0ms
(/ x (expm1 x))

series55.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

32.0ms
(/ x (expm1 x))
23.0ms
(/ 1 (/ x (expm1 x)))

simplify291.0ms

Counts
15 → 41
Calls

15 calls. Slowest were:

110.0ms
(* -1 (/ (- 1 (exp x)) x))
72.0ms
(+ (* 1/2 x) (+ (* 1/6 (pow x 2)) 1))
72.0ms
(- (+ (* 1/12 (pow x 2)) 1) (* 1/2 x))

prune419.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize12.0ms

Local error

Found 4 expressions with local error:

0.3b
(cbrt (/ (expm1 x) x))
0.3b
(cbrt (/ (expm1 x) x))
0.3b
(cbrt (/ (expm1 x) x))
0.2b
(* (cbrt (/ (expm1 x) x)) (cbrt (/ (expm1 x) x)))

rewrite15.0ms

Algorithm
rewrite-expression-head
Counts
4 → 80
Calls

4 calls. Slowest were:

10.0ms
(* (cbrt (/ (expm1 x) x)) (cbrt (/ (expm1 x) x)))
1.0ms
(cbrt (/ (expm1 x) x))
1.0ms
(cbrt (/ (expm1 x) x))

series795.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

214.0ms
(cbrt (/ (expm1 x) x))
213.0ms
(* (cbrt (/ (expm1 x) x)) (cbrt (/ (expm1 x) x)))
184.0ms
(cbrt (/ (expm1 x) x))
184.0ms
(cbrt (/ (expm1 x) x))

simplify1.8s

Counts
53 → 92
Calls

53 calls. Slowest were:

273.0ms
(* (pow (cbrt -1) 2) (exp (* 1/3 (+ (* 2 (log (/ -1 x))) (log (pow (- (exp x) 1) 2))))))
261.0ms
(exp (* 1/3 (+ (* 2 (log (/ 1 x))) (log (pow (- (exp x) 1) 2)))))
202.0ms
(* (exp (* 1/3 (+ (log (- (exp x) 1)) (log (/ -1 x))))) (cbrt -1))

prune827.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

localize8.0ms

Local error

Found 4 expressions with local error:

16.1b
(cbrt (* (* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x)))) (/ 1 (/ x (expm1 x)))))
0.1b
(* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x))))
0.1b
(* (* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x)))) (/ 1 (/ x (expm1 x))))
0.0b
(/ x (expm1 x))

rewrite40.0ms

Algorithm
rewrite-expression-head
Counts
4 → 133
Calls

4 calls. Slowest were:

20.0ms
(* (* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x)))) (/ 1 (/ x (expm1 x))))
7.0ms
(cbrt (* (* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x)))) (/ 1 (/ x (expm1 x)))))
4.0ms
(* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x))))

series171.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

61.0ms
(cbrt (* (* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x)))) (/ 1 (/ x (expm1 x)))))
54.0ms
(* (* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x)))) (/ 1 (/ x (expm1 x))))
30.0ms
(* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x))))
25.0ms
(/ x (expm1 x))

simplify8.8s

Counts
122 → 145
Calls

122 calls. Slowest were:

438.0ms
(* (* (* (* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x)))) (* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x))))) (* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x))))) (* (* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x)))) (/ 1 (/ x (expm1 x)))))
419.0ms
(* (* (/ 1 (/ x (expm1 x))) (/ 1 (/ x (expm1 x)))) (/ 1 (/ x (expm1 x))))
371.0ms
(* -1 (/ (- (* (cbrt -1) (exp x)) (cbrt -1)) x))

prune1.5s

Pruning

3 alts after pruning (0 fresh and 3 done)

Merged error: 0b

regimes21.0ms

Accuracy

0% (0.0b remaining)

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

bsearch0.0ms