Average Error: 29.7 → 1.1
Time: 2.0m
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 111.9247683550667:\\ \;\;\;\;\frac{(\left(\frac{2}{3} \cdot x\right) \cdot \left(x \cdot x\right) + 2)_* - x \cdot x}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(e^{-\left(\varepsilon \cdot x + x\right)} + e^{\varepsilon \cdot x - x}\right) + \frac{e^{\varepsilon \cdot x - x}}{\varepsilon}\right) - \frac{e^{-\left(\varepsilon \cdot x + x\right)}}{\varepsilon}}{2}\\ \end{array}\]

Error

Bits error versus x

Bits error versus eps

Derivation

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

    1. Initial program 39.6

      \[\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.4

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

      \[\leadsto \frac{\color{blue}{\frac{\left(\frac{2}{3} \cdot {x}^{3}\right) \cdot \left(\frac{2}{3} \cdot {x}^{3}\right) - 2 \cdot 2}{\frac{2}{3} \cdot {x}^{3} - 2}} - {x}^{2}}{2}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity1.4

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

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{\left(\frac{2}{3} \cdot {x}^{3}\right) \cdot \left(\frac{2}{3} \cdot {x}^{3}\right) - 2 \cdot 2}{\frac{2}{3} \cdot {x}^{3} - 2}} - 1 \cdot {x}^{2}}{2}\]
    8. Applied distribute-lft-out--1.4

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\frac{\left(\frac{2}{3} \cdot {x}^{3}\right) \cdot \left(\frac{2}{3} \cdot {x}^{3}\right) - 2 \cdot 2}{\frac{2}{3} \cdot {x}^{3} - 2} - {x}^{2}\right)}}{2}\]
    9. Simplified1.4

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

    if 111.9247683550667 < x

    1. Initial program 0.2

      \[\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 -inf 0.2

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

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

Reproduce

herbie shell --seed 2019007 +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: 2.0m)Debug log

sample340.0ms

Algorithm
intervals

simplify180.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune15.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.4b

localize58.0ms

Local error

Found 4 expressions with local error:

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

rewrite42.0ms

Algorithm
rewrite-expression-head
Counts
4 → 150
Calls

4 calls. Slowest were:

18.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
7.0ms
(exp (- (* (+ 1 eps) x)))
6.0ms
(exp (- (* (- 1 eps) x)))

series143.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

94.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
22.0ms
(* (- 1 eps) x)
14.0ms
(exp (- (* (+ 1 eps) x)))
13.0ms
(exp (- (* (- 1 eps) x)))

simplify49.2s

Counts
198 → 162
Calls

198 calls. Slowest were:

1.0s
(- (* (* (- (* 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))))
1.0s
(- (* (* (+ (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))))
789.0ms
(- (* (* (- (* 1 1) (* (/ 1 eps) (/ 1 eps))) (exp 0)) (* (+ (/ 1 eps) 1) (exp (* (+ 1 eps) x)))) (* (* (- 1 (/ 1 eps)) (exp (* (- 1 eps) x))) (* (- (* (/ 1 eps) (/ 1 eps)) (* 1 1)) 1)))

prune2.8s

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.6b

localize19.0ms

Local error

Found 3 expressions with local error:

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

rewrite26.0ms

Algorithm
rewrite-expression-head
Counts
3 → 61
Calls

3 calls. Slowest were:

14.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
5.0ms
(* 2/3 (pow x 3))
5.0ms
(+ (* 2/3 (pow x 3)) 2)

series83.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

44.0ms
(+ (* 2/3 (pow x 3)) 2)
24.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
15.0ms
(* 2/3 (pow x 3))

simplify2.2s

Counts
46 → 70
Calls

46 calls. Slowest were:

227.0ms
(fma 1 (+ (* 2/3 (pow x 3)) 2) (- (* (pow x 2) 1)))
222.0ms
(fma 1 (+ (* 2/3 (pow x 3)) 2) (- (* x x)))
172.0ms
(fma 1 (+ (* 2/3 (pow x 3)) 2) (- (* (sqrt (pow x 2)) (sqrt (pow x 2)))))

prune800.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0.6b

localize42.0ms

Local error

Found 4 expressions with local error:

11.1b
(/ (- (* (* 2/3 (pow x 3)) (* 2/3 (pow x 3))) (* 2 2)) (- (* 2/3 (pow x 3)) 2))
7.4b
(- (/ (- (* (* 2/3 (pow x 3)) (* 2/3 (pow x 3))) (* 2 2)) (- (* 2/3 (pow x 3)) 2)) (pow x 2))
0.1b
(* 2/3 (pow x 3))
0.1b
(* 2/3 (pow x 3))

rewrite161.0ms

Algorithm
rewrite-expression-head
Counts
4 → 178
Calls

4 calls. Slowest were:

113.0ms
(- (/ (- (* (* 2/3 (pow x 3)) (* 2/3 (pow x 3))) (* 2 2)) (- (* 2/3 (pow x 3)) 2)) (pow x 2))
37.0ms
(/ (- (* (* 2/3 (pow x 3)) (* 2/3 (pow x 3))) (* 2 2)) (- (* 2/3 (pow x 3)) 2))
2.0ms
(* 2/3 (pow x 3))

series186.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

101.0ms
(/ (- (* (* 2/3 (pow x 3)) (* 2/3 (pow x 3))) (* 2 2)) (- (* 2/3 (pow x 3)) 2))
46.0ms
(- (/ (- (* (* 2/3 (pow x 3)) (* 2/3 (pow x 3))) (* 2 2)) (- (* 2/3 (pow x 3)) 2)) (pow x 2))
24.0ms
(* 2/3 (pow x 3))
15.0ms
(* 2/3 (pow x 3))

simplify46.4s

Counts
229 → 190
Calls

229 calls. Slowest were:

3.5s
(fma (/ (- (* (* 2/3 (pow x 3)) (* 2/3 (pow x 3))) (* 2 2)) (- (* (* 2/3 (pow x 3)) (* 2/3 (pow x 3))) (* 2 2))) (+ (* 2/3 (pow x 3)) 2) (- (* (sqrt (pow x 2)) (sqrt (pow x 2)))))
2.8s
(fma (/ (- (* (* 2/3 (pow x 3)) (* 2/3 (pow x 3))) (* 2 2)) (- (* (* 2/3 (pow x 3)) (* 2/3 (pow x 3))) (* 2 2))) (+ (* 2/3 (pow x 3)) 2) (- (* x x)))
1.9s
(fma (/ (- (* (* 2/3 (pow x 3)) (* 2/3 (pow x 3))) (* 2 2)) (- (* (* 2/3 (pow x 3)) (* 2/3 (pow x 3))) (* 2 2))) (+ (* 2/3 (pow x 3)) 2) (- (* (pow x 2) 1)))

prune2.2s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.6b

localize16.0ms

Local error

Found 3 expressions with local error:

7.4b
(- (fma (* 2/3 x) (* x x) 2) (* x x))
0.4b
(* 2/3 x)
0.0b
(fma (* 2/3 x) (* x x) 2)

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
3 → 42
Calls

3 calls. Slowest were:

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

series105.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

65.0ms
(fma (* 2/3 x) (* x x) 2)
28.0ms
(- (fma (* 2/3 x) (* x x) 2) (* x x))
12.0ms
(* 2/3 x)

simplify559.0ms

Counts
21 → 51
Calls

21 calls. Slowest were:

88.0ms
(fma 1 (fma (* 2/3 x) (* x x) 2) (- (* x x)))
77.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
66.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

prune538.0ms

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0.6b

regimes209.0ms

Accuracy

96.2% (0.6b remaining)

Error of 1.1b against oracle of 0.4b and baseline of 16.9b

bsearch539.0ms

end0.0ms

sample12.0s

Algorithm
intervals