Average Error: 29.6 → 1.1
Time: 1.4m
Precision: 64
Internal Precision: 128
\[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}\]
\[\begin{array}{l} \mathbf{if}\;x \le 354.78477434902067:\\ \;\;\;\;\frac{e^{\log \left((\left(x \cdot x\right) \cdot \left((\frac{2}{3} \cdot x + -1)_*\right) + 2)_*\right)}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{(\left(e^{\left(-1 + \varepsilon\right) \cdot x}\right) \cdot \left(\frac{1}{\varepsilon} + 1\right) + \left(\frac{\frac{-1}{\varepsilon} + 1}{e^{(x \cdot \varepsilon + x)_*}}\right))_*}{2}\\ \end{array}\]

Error

Bits error versus x

Bits error versus eps

Derivation

  1. Split input into 2 regimes
  2. if x < 354.78477434902067

    1. Initial program 39.1

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}\]
    2. Taylor expanded around 0 1.5

      \[\leadsto \frac{\color{blue}{\left(\frac{2}{3} \cdot {x}^{3} + 2\right) - {x}^{2}}}{2}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt1.5

      \[\leadsto \frac{\left(\frac{2}{3} \cdot {x}^{3} + 2\right) - \color{blue}{\sqrt{{x}^{2}} \cdot \sqrt{{x}^{2}}}}{2}\]
    5. Applied *-un-lft-identity1.5

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\frac{2}{3} \cdot {x}^{3} + 2\right)} - \sqrt{{x}^{2}} \cdot \sqrt{{x}^{2}}}{2}\]
    6. Applied prod-diff1.5

      \[\leadsto \frac{\color{blue}{(1 \cdot \left(\frac{2}{3} \cdot {x}^{3} + 2\right) + \left(-\sqrt{{x}^{2}} \cdot \sqrt{{x}^{2}}\right))_* + (\left(-\sqrt{{x}^{2}}\right) \cdot \left(\sqrt{{x}^{2}}\right) + \left(\sqrt{{x}^{2}} \cdot \sqrt{{x}^{2}}\right))_*}}{2}\]
    7. Simplified1.5

      \[\leadsto \frac{\color{blue}{(\left(x \cdot x\right) \cdot \left((\frac{2}{3} \cdot x + -1)_*\right) + 2)_*} + (\left(-\sqrt{{x}^{2}}\right) \cdot \left(\sqrt{{x}^{2}}\right) + \left(\sqrt{{x}^{2}} \cdot \sqrt{{x}^{2}}\right))_*}{2}\]
    8. Simplified1.5

      \[\leadsto \frac{(\left(x \cdot x\right) \cdot \left((\frac{2}{3} \cdot x + -1)_*\right) + 2)_* + \color{blue}{0}}{2}\]
    9. Using strategy rm
    10. Applied add-exp-log1.5

      \[\leadsto \frac{\color{blue}{e^{\log \left((\left(x \cdot x\right) \cdot \left((\frac{2}{3} \cdot x + -1)_*\right) + 2)_*\right)}} + 0}{2}\]
    11. Taylor expanded around inf 1.5

      \[\leadsto \frac{e^{\log \left((\left(x \cdot x\right) \cdot \color{blue}{\left(\frac{2}{3} \cdot x - 1\right)} + 2)_*\right)} + 0}{2}\]
    12. Simplified1.5

      \[\leadsto \frac{e^{\log \left((\left(x \cdot x\right) \cdot \color{blue}{\left((\frac{2}{3} \cdot x + -1)_*\right)} + 2)_*\right)} + 0}{2}\]

    if 354.78477434902067 < x

    1. Initial program 0.0

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}\]
    2. Using strategy rm
    3. Applied prod-diff0.0

      \[\leadsto \frac{\color{blue}{(\left(1 + \frac{1}{\varepsilon}\right) \cdot \left(e^{-\left(1 - \varepsilon\right) \cdot x}\right) + \left(-e^{-\left(1 + \varepsilon\right) \cdot x} \cdot \left(\frac{1}{\varepsilon} - 1\right)\right))_* + (\left(-e^{-\left(1 + \varepsilon\right) \cdot x}\right) \cdot \left(\frac{1}{\varepsilon} - 1\right) + \left(e^{-\left(1 + \varepsilon\right) \cdot x} \cdot \left(\frac{1}{\varepsilon} - 1\right)\right))_*}}{2}\]
    4. Simplified0.0

      \[\leadsto \frac{\color{blue}{(\left(e^{x \cdot \left(-1 + \varepsilon\right)}\right) \cdot \left(1 + \frac{1}{\varepsilon}\right) + \left(\frac{1 + \frac{-1}{\varepsilon}}{e^{(x \cdot \varepsilon + x)_*}}\right))_*} + (\left(-e^{-\left(1 + \varepsilon\right) \cdot x}\right) \cdot \left(\frac{1}{\varepsilon} - 1\right) + \left(e^{-\left(1 + \varepsilon\right) \cdot x} \cdot \left(\frac{1}{\varepsilon} - 1\right)\right))_*}{2}\]
    5. Simplified0.0

      \[\leadsto \frac{(\left(e^{x \cdot \left(-1 + \varepsilon\right)}\right) \cdot \left(1 + \frac{1}{\varepsilon}\right) + \left(\frac{1 + \frac{-1}{\varepsilon}}{e^{(x \cdot \varepsilon + x)_*}}\right))_* + \color{blue}{0}}{2}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 354.78477434902067:\\ \;\;\;\;\frac{e^{\log \left((\left(x \cdot x\right) \cdot \left((\frac{2}{3} \cdot x + -1)_*\right) + 2)_*\right)}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{(\left(e^{\left(-1 + \varepsilon\right) \cdot x}\right) \cdot \left(\frac{1}{\varepsilon} + 1\right) + \left(\frac{\frac{-1}{\varepsilon} + 1}{e^{(x \cdot \varepsilon + x)_*}}\right))_*}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019005 +o rules:numerics
(FPCore (x eps)
  :name "NMSE Section 6.1 mentioned, A"
  (/ (- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))) 2))

Details

Time bar (total: 1.4m)Debug log

sample471.0ms

Algorithm
intervals

simplify144.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

144.0ms
(/ (- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))) 2)

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 32.7b

localize35.0ms

Local error

Found 4 expressions with local error:

3.9b
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
0.0b
(* (- 1 eps) x)
0.0b
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))
0.0b
(* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))

rewrite55.0ms

Algorithm
rewrite-expression-head
Counts
4 → 169
Calls

4 calls. Slowest were:

21.0ms
(* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))
13.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
11.0ms
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))

series181.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

110.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
25.0ms
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))
23.0ms
(* (- 1 eps) x)
23.0ms
(* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))

simplify60.0s

Counts
225 → 181
Calls

225 calls. Slowest were:

1.2s
(- (* (* (+ (pow 1 3) (pow (/ 1 eps) 3)) (exp 0)) (* (+ (/ 1 eps) 1) (exp (* (+ 1 eps) x)))) (* (* (+ (* 1 1) (- (* (/ 1 eps) (/ 1 eps)) (* 1 (/ 1 eps)))) (exp (* (- 1 eps) x))) (* (- (* (/ 1 eps) (/ 1 eps)) (* 1 1)) (exp 0))))
980.0ms
(cbrt (exp (- (* (+ 1 eps) x))))
967.0ms
(- (* (* (- (* 1 1) (* (/ 1 eps) (/ 1 eps))) 1) (* (+ (/ 1 eps) 1) (exp (* (+ 1 eps) x)))) (* (* (- 1 (/ 1 eps)) (exp (* (- 1 eps) x))) (* (- (* (/ 1 eps) (/ 1 eps)) (* 1 1)) (exp 0))))

prune3.0s

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.5b

localize27.0ms

Local error

Found 2 expressions with local error:

6.6b
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
0.1b
(* 2/3 (pow x 3))

rewrite38.0ms

Algorithm
rewrite-expression-head
Counts
2 → 48
Calls

2 calls. Slowest were:

34.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
2.0ms
(* 2/3 (pow x 3))

series55.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

28.0ms
(* 2/3 (pow x 3))
27.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

simplify2.1s

Counts
43 → 54
Calls

43 calls. Slowest were:

218.0ms
(fma 1 (+ (* 2/3 (pow x 3)) 2) (- (* (sqrt (pow x 2)) (sqrt (pow x 2)))))
183.0ms
(fma (sqrt (+ (* 2/3 (pow x 3)) 2)) (sqrt (+ (* 2/3 (pow x 3)) 2)) (- (* (pow x 2) 1)))
158.0ms
(fma 1 (+ (* 2/3 (pow x 3)) 2) (- (* (pow x 2) 1)))

prune594.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.5b

localize31.0ms

Local error

Found 2 expressions with local error:

0.1b
(fma 2/3 x -1)
0.0b
(fma (* x x) (fma 2/3 x -1) 2)

rewrite1.0ms

Algorithm
rewrite-expression-head
Counts
2 → 20
Calls

2 calls. Slowest were:

0.0ms
(fma 2/3 x -1)
0.0ms
(fma (* x x) (fma 2/3 x -1) 2)

series46.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

26.0ms
(fma 2/3 x -1)
19.0ms
(fma (* x x) (fma 2/3 x -1) 2)

simplify246.0ms

Counts
6 → 26
Calls

6 calls. Slowest were:

105.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
69.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
58.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

prune203.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.5b

localize11.0ms

Local error

Found 4 expressions with local error:

9.4b
(log (fma (* x x) (fma 2/3 x -1) 2))
0.4b
(exp (log (fma (* x x) (fma 2/3 x -1) 2)))
0.1b
(fma 2/3 x -1)
0.0b
(fma (* x x) (fma 2/3 x -1) 2)

rewrite4.0ms

Algorithm
rewrite-expression-head
Counts
4 → 51
Calls

4 calls. Slowest were:

2.0ms
(exp (log (fma (* x x) (fma 2/3 x -1) 2)))
1.0ms
(log (fma (* x x) (fma 2/3 x -1) 2))
0.0ms
(fma 2/3 x -1)

series84.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

32.0ms
(log (fma (* x x) (fma 2/3 x -1) 2))
21.0ms
(exp (log (fma (* x x) (fma 2/3 x -1) 2)))
17.0ms
(fma (* x x) (fma 2/3 x -1) 2)
14.0ms
(fma 2/3 x -1)

simplify2.1s

Counts
24 → 63
Calls

24 calls. Slowest were:

468.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
349.0ms
(- (log -2/3) (+ (* 3 (log (/ -1 x))) (+ (* 9/8 (/ 1 (pow x 2))) (* 3/2 (/ 1 x)))))
240.0ms
(- (log 2/3) (+ (* 3 (log (/ 1 x))) (+ (* 9/8 (/ 1 (pow x 2))) (* 3/2 (/ 1 x)))))

prune589.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.5b

regimes131.0ms

Accuracy

95.8% (0.7b remaining)

Error of 1.1b against oracle of 0.5b and baseline of 16.5b

bsearch482.0ms

end0.0ms

sample12.5s

Algorithm
intervals