Average Error: 39.8 → 0.7
Time: 11.3s
Precision: 64
Internal Precision: 128
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.001988566952708495:\\ \;\;\;\;\frac{e^{x}}{\log \left(e^{e^{x} - 1}\right)}\\ \mathbf{else}:\\ \;\;\;\;{\left(x \cdot \left(\frac{1}{144} \cdot x\right)\right)}^{\frac{1}{3}} \cdot \sqrt[3]{x \cdot \frac{1}{12}} + \left(\frac{1}{2} + \frac{1}{x}\right)\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original39.8
Target39.4
Herbie0.7
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -0.001988566952708495

    1. Initial program 0.0

      \[\frac{e^{x}}{e^{x} - 1}\]
    2. Using strategy rm
    3. Applied add-log-exp0.0

      \[\leadsto \frac{e^{x}}{\color{blue}{\log \left(e^{e^{x} - 1}\right)}}\]

    if -0.001988566952708495 < x

    1. Initial program 59.9

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

      \[\leadsto \color{blue}{\frac{1}{12} \cdot x + \left(\frac{1}{x} + \frac{1}{2}\right)}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt1.0

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{1}{12} \cdot x} \cdot \sqrt[3]{\frac{1}{12} \cdot x}\right) \cdot \sqrt[3]{\frac{1}{12} \cdot x}} + \left(\frac{1}{x} + \frac{1}{2}\right)\]
    5. Using strategy rm
    6. Applied pow1/332.4

      \[\leadsto \left(\sqrt[3]{\frac{1}{12} \cdot x} \cdot \color{blue}{{\left(\frac{1}{12} \cdot x\right)}^{\frac{1}{3}}}\right) \cdot \sqrt[3]{\frac{1}{12} \cdot x} + \left(\frac{1}{x} + \frac{1}{2}\right)\]
    7. Applied pow1/332.4

      \[\leadsto \left(\color{blue}{{\left(\frac{1}{12} \cdot x\right)}^{\frac{1}{3}}} \cdot {\left(\frac{1}{12} \cdot x\right)}^{\frac{1}{3}}\right) \cdot \sqrt[3]{\frac{1}{12} \cdot x} + \left(\frac{1}{x} + \frac{1}{2}\right)\]
    8. Applied pow-prod-down1.0

      \[\leadsto \color{blue}{{\left(\left(\frac{1}{12} \cdot x\right) \cdot \left(\frac{1}{12} \cdot x\right)\right)}^{\frac{1}{3}}} \cdot \sqrt[3]{\frac{1}{12} \cdot x} + \left(\frac{1}{x} + \frac{1}{2}\right)\]
    9. Simplified1.0

      \[\leadsto {\color{blue}{\left(x \cdot \left(\frac{1}{144} \cdot x\right)\right)}}^{\frac{1}{3}} \cdot \sqrt[3]{\frac{1}{12} \cdot x} + \left(\frac{1}{x} + \frac{1}{2}\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.001988566952708495:\\ \;\;\;\;\frac{e^{x}}{\log \left(e^{e^{x} - 1}\right)}\\ \mathbf{else}:\\ \;\;\;\;{\left(x \cdot \left(\frac{1}{144} \cdot x\right)\right)}^{\frac{1}{3}} \cdot \sqrt[3]{x \cdot \frac{1}{12}} + \left(\frac{1}{2} + \frac{1}{x}\right)\\ \end{array}\]

Reproduce

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

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

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

Details

Time bar (total: 10.4s)Debug log

sample137.0ms

Algorithm
intervals

simplify7.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

7.0ms
(/ (exp x) (- (exp x) 1))

prune8.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 41.1b

localize16.0ms

Local error

Found 2 expressions with local error:

6.1b
(- (exp x) 1)
0.5b
(/ (exp x) (- (exp x) 1))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
2 → 45
Calls

2 calls. Slowest were:

10.0ms
(/ (exp x) (- (exp x) 1))
5.0ms
(- (exp x) 1)

series55.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

29.0ms
(- (exp x) 1)
26.0ms
(/ (exp x) (- (exp x) 1))

simplify658.0ms

Counts
41 → 51
Calls

41 calls. Slowest were:

325.0ms
(/ (* (* (exp x) (exp x)) (exp x)) (* (* (- (exp x) 1) (- (exp x) 1)) (- (exp x) 1)))
89.0ms
(+ x (+ (* 1/6 (pow x 3)) (* 1/2 (pow x 2))))
28.0ms
(+ (* (exp x) (exp x)) (+ (* 1 1) (* (exp x) 1)))

prune410.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.5b

localize13.0ms

Local error

Found 2 expressions with local error:

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

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
2 → 20
Calls

2 calls. Slowest were:

11.0ms
(+ (* 1/12 x) (+ (/ 1 x) 1/2))
0.0ms
(* 1/12 x)

series16.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

9.0ms
(* 1/12 x)
7.0ms
(+ (* 1/12 x) (+ (/ 1 x) 1/2))

simplify91.0ms

Counts
7 → 26
Calls

7 calls. Slowest were:

28.0ms
(* (exp (* 1/12 x)) (exp (+ (/ 1 x) 1/2)))
20.0ms
(+ (* 1/12 x) (+ (/ 1 x) 1/2))
18.0ms
(+ (* 1/12 x) (+ (/ 1 x) 1/2))

prune223.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.5b

localize23.0ms

Local error

Found 4 expressions with local error:

0.6b
(cbrt (* 1/12 x))
0.6b
(cbrt (* 1/12 x))
0.6b
(cbrt (* 1/12 x))
0.5b
(* (cbrt (* 1/12 x)) (cbrt (* 1/12 x)))

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 51
Calls

4 calls. Slowest were:

9.0ms
(* (cbrt (* 1/12 x)) (cbrt (* 1/12 x)))
1.0ms
(cbrt (* 1/12 x))
1.0ms
(cbrt (* 1/12 x))

series1.3s

Counts
4 → 12
Calls

4 calls. Slowest were:

370.0ms
(* (cbrt (* 1/12 x)) (cbrt (* 1/12 x)))
324.0ms
(cbrt (* 1/12 x))
324.0ms
(cbrt (* 1/12 x))
316.0ms
(cbrt (* 1/12 x))

simplify178.0ms

Counts
31 → 63
Calls

31 calls. Slowest were:

18.0ms
(* (pow (pow x 2) 1/3) (pow (cbrt 1/12) 2))
17.0ms
(* (pow (pow x 2) 1/3) (pow (cbrt -1/12) 2))
17.0ms
(* (pow (pow x 2) 1/3) (pow (cbrt 1/12) 2))

prune623.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.5b

localize29.0ms

Local error

Found 4 expressions with local error:

32.2b
(pow (* x (* 1/144 x)) 1/3)
0.6b
(cbrt (* 1/12 x))
0.4b
(* 1/144 x)
0.4b
(* (pow (* x (* 1/144 x)) 1/3) (cbrt (* 1/12 x)))

rewrite15.0ms

Algorithm
rewrite-expression-head
Counts
4 → 51
Calls

4 calls. Slowest were:

10.0ms
(* (pow (* x (* 1/144 x)) 1/3) (cbrt (* 1/12 x)))
2.0ms
(pow (* x (* 1/144 x)) 1/3)
1.0ms
(cbrt (* 1/12 x))

series1.0s

Counts
4 → 12
Calls

4 calls. Slowest were:

447.0ms
(* (pow (* x (* 1/144 x)) 1/3) (cbrt (* 1/12 x)))
308.0ms
(pow (* x (* 1/144 x)) 1/3)
272.0ms
(cbrt (* 1/12 x))
13.0ms
(* 1/144 x)

simplify920.0ms

Counts
29 → 63
Calls

29 calls. Slowest were:

174.0ms
(exp (* 1/3 (- (log 1/144) (* 2 (log (/ -1 x))))))
149.0ms
(exp (* 1/3 (- (log 1/144) (* 2 (log (/ 1 x))))))
100.0ms
(* (* (* (pow (* x (* 1/144 x)) 1/3) (pow (* x (* 1/144 x)) 1/3)) (pow (* x (* 1/144 x)) 1/3)) (* 1/12 x))

prune703.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 0.5b

regimes120.0ms

Accuracy

98.7% (0.3b remaining)

Error of 0.7b against oracle of 0.4b and baseline of 21.5b

bsearch49.0ms

end0.0ms

sample3.7s

Algorithm
intervals