Average Error: 39.9 → 1.0
Time: 15.5s
Precision: 64
Internal Precision: 128
\[\frac{e^{x}}{e^{x} - 1}\]
\[\frac{e^{x}}{x + \left(x \cdot \frac{1}{6} + \frac{1}{2}\right) \cdot \left(x \cdot x\right)}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original39.9
Target39.5
Herbie1.0
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Initial program 39.9

    \[\frac{e^{x}}{e^{x} - 1}\]
  2. Initial simplification39.9

    \[\leadsto \frac{e^{x}}{e^{x} - 1}\]
  3. Taylor expanded around 0 11.6

    \[\leadsto \frac{e^{x}}{\color{blue}{x + \left(\frac{1}{6} \cdot {x}^{3} + \frac{1}{2} \cdot {x}^{2}\right)}}\]
  4. Simplified1.0

    \[\leadsto \frac{e^{x}}{\color{blue}{x + \left(x \cdot \frac{1}{6} + \frac{1}{2}\right) \cdot \left(x \cdot x\right)}}\]
  5. Final simplification1.0

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

Reproduce

herbie shell --seed 2018362 
(FPCore (x)
  :name "expq2 (section 3.11)"

  :herbie-target
  (/ 1 (- 1 (exp (- x))))

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

Details

Time bar (total: 7.9s)Debug log

start218.0ms

Algorithm
intervals

setup22.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 45.9b

localize16.0ms

Local error

Found 2 expressions with local error:

5.4b
(- (exp x) 1)
0.7b
(/ (exp x) (- (exp x) 1))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
2 → 45
Calls

2 calls. Slowest were:

11.0ms
(/ (exp x) (- (exp x) 1))
6.0ms
(- (exp x) 1)

series61.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

31.0ms
(- (exp x) 1)
30.0ms
(/ (exp x) (- (exp x) 1))

simplify673.0ms

Counts
41 → 51
Calls

41 calls. Slowest were:

346.0ms
(/ (* (* (exp x) (exp x)) (exp x)) (* (* (- (exp x) 1) (- (exp x) 1)) (- (exp x) 1)))
108.0ms
(+ x (+ (* 1/6 (pow x 3)) (* 1/2 (pow x 2))))
38.0ms
(+ (* (exp x) (exp x)) (+ (* 1 1) (* (exp x) 1)))

prune495.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.7b

localize28.0ms

Local error

Found 4 expressions with local error:

0.3b
(* x 1/6)
0.0b
(* (+ (* x 1/6) 1/2) (* x x))
0.0b
(/ (exp x) (+ x (* (+ (* x 1/6) 1/2) (* x x))))
0.0b
(+ x (* (+ (* x 1/6) 1/2) (* x x)))

rewrite10.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

5.0ms
(* (+ (* x 1/6) 1/2) (* x x))
3.0ms
(/ (exp x) (+ x (* (+ (* x 1/6) 1/2) (* x x))))
2.0ms
(+ x (* (+ (* x 1/6) 1/2) (* x x)))

series70.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

27.0ms
(* (+ (* x 1/6) 1/2) (* x x))
21.0ms
(/ (exp x) (+ x (* (+ (* x 1/6) 1/2) (* x x))))
15.0ms
(+ x (* (+ (* x 1/6) 1/2) (* x x)))
7.0ms
(* x 1/6)

simplify3.8s

Counts
46 → 76
Calls

46 calls. Slowest were:

466.0ms
(* (+ (pow (* x 1/6) 3) (pow 1/2 3)) (* x x))
430.0ms
(* (- (* (* x 1/6) (* x 1/6)) (* 1/2 1/2)) (* x x))
186.0ms
(- x (* (+ (* x 1/6) 1/2) (* x x)))

prune864.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.7b

localize10.0ms

Local error

Found 3 expressions with local error:

0.3b
(* 1/12 x)
0.0b
(+ (* 1/12 x) (+ (/ 1 x) 1/2))
0.0b
(+ (/ 1 x) 1/2)

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
3 → 30
Calls

3 calls. Slowest were:

6.0ms
(+ (* 1/12 x) (+ (/ 1 x) 1/2))
5.0ms
(+ (/ 1 x) 1/2)
0.0ms
(* 1/12 x)

series26.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

10.0ms
(+ (/ 1 x) 1/2)
8.0ms
(+ (* 1/12 x) (+ (/ 1 x) 1/2))
7.0ms
(* 1/12 x)

simplify89.0ms

Counts
10 → 39
Calls

10 calls. Slowest were:

41.0ms
(* (exp (* 1/12 x)) (exp (+ (/ 1 x) 1/2)))
13.0ms
(+ (* 1/12 x) (+ (/ 1 x) 1/2))
8.0ms
(+ (* 1/12 x) (+ (/ 1 x) 1/2))

prune371.0ms

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0.7b

localize13.0ms

Local error

Found 4 expressions with local error:

2.2b
(exp (log (* 1/12 x)))
0.3b
(* 1/12 x)
0.0b
(+ (exp (log (* 1/12 x))) (+ (/ 1 x) 1/2))
0.0b
(+ (/ 1 x) 1/2)

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
4 → 44
Calls

4 calls. Slowest were:

24.0ms
(+ (exp (log (* 1/12 x))) (+ (/ 1 x) 1/2))
4.0ms
(+ (/ 1 x) 1/2)
4.0ms
(exp (log (* 1/12 x)))

series31.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

10.0ms
(exp (log (* 1/12 x)))
7.0ms
(+ (exp (log (* 1/12 x))) (+ (/ 1 x) 1/2))
7.0ms
(+ (/ 1 x) 1/2)
7.0ms
(* 1/12 x)

simplify157.0ms

Counts
19 → 56
Calls

19 calls. Slowest were:

43.0ms
(* (exp (exp (log (* 1/12 x)))) (exp (+ (/ 1 x) 1/2)))
27.0ms
(+ (exp (log (* 1/12 x))) (+ (/ 1 x) 1/2))
16.0ms
(+ (* 1/12 x) (+ (/ 1 x) 1/2))

prune723.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.7b

regimes114.0ms

Accuracy

0% (0.6b remaining)

Error of 1.0b against oracle of 0.3b and baseline of 1.0b

bsearch2.0ms