Average Error: 29.8 → 1.1
Time: 1.2m
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 310.8796801255867:\\ \;\;\;\;\frac{\sqrt[3]{\frac{2}{3} \cdot {x}^{3}} \cdot \left((e^{\log_* (1 + \sqrt[3]{\frac{2}{3} \cdot {x}^{3}})} - 1)^* \cdot \sqrt[3]{\frac{2}{3} \cdot {x}^{3}}\right) + \left(2 - {x}^{2}\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} \cdot \left(1 + \frac{1}{\varepsilon}\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}} \cdot \sqrt{e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} \cdot \left(1 + \frac{1}{\varepsilon}\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}}{2}\\ \end{array}\]

Error

Bits error versus x

Bits error versus eps

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

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

    1. Initial program 39.4

      \[\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 associate--l+1.4

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

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{\frac{2}{3} \cdot {x}^{3}} \cdot \sqrt[3]{\frac{2}{3} \cdot {x}^{3}}\right) \cdot \sqrt[3]{\frac{2}{3} \cdot {x}^{3}}} + \left(2 - {x}^{2}\right)}{2}\]
    7. Using strategy rm
    8. Applied expm1-log1p-u1.4

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

    if 310.8796801255867 < 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. Using strategy rm
    3. Applied add-sqr-sqrt0.2

      \[\leadsto \frac{\color{blue}{\sqrt{\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}} \cdot \sqrt{\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}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.1

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

Reproduce

herbie shell --seed 2019008 +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.2m)Debug log

sample448.0ms

Algorithm
intervals

simplify620.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

620.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.8b

localize63.0ms

Local error

Found 4 expressions with local error:

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

rewrite25.0ms

Algorithm
rewrite-expression-head
Counts
4 → 150
Calls

4 calls. Slowest were:

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

series201.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

134.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
23.0ms
(exp (- (* (+ 1 eps) x)))
23.0ms
(* (- 1 eps) x)
21.0ms
(exp (- (* (- 1 eps) x)))

simplify51.1s

Counts
198 → 162
Calls

198 calls. Slowest were:

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))))
932.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))))
840.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)) (exp 0))))

prune2.7s

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.5b

localize18.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))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
2 → 48
Calls

2 calls. Slowest were:

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

series32.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

16.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
16.0ms
(* 2/3 (pow x 3))

simplify2.3s

Counts
43 → 54
Calls

43 calls. Slowest were:

250.0ms
(fma 1 (+ (* 2/3 (pow x 3)) 2) (- (* (sqrt (pow x 2)) (sqrt (pow x 2)))))
200.0ms
(fma 1 (+ (* 2/3 (pow x 3)) 2) (- (* (pow x 2) 1)))
195.0ms
(fma (sqrt (+ (* 2/3 (pow x 3)) 2)) (sqrt (+ (* 2/3 (pow x 3)) 2)) (- (* (pow x 2) 1)))

prune534.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.5b

localize10.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))

rewrite9.0ms

Algorithm
rewrite-expression-head
Counts
2 → 32
Calls

2 calls. Slowest were:

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

series34.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

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

simplify361.0ms

Counts
14 → 38
Calls

14 calls. Slowest were:

114.0ms
(* (exp (* 2/3 (pow x 3))) (exp (- 2 (pow x 2))))
81.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
75.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

prune430.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.5b

localize19.0ms

Local error

Found 4 expressions with local error:

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

rewrite34.0ms

Algorithm
rewrite-expression-head
Counts
4 → 50
Calls

4 calls. Slowest were:

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

series241.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

64.0ms
(cbrt (* 2/3 (pow x 3)))
62.0ms
(cbrt (* 2/3 (pow x 3)))
59.0ms
(+ (* (* (cbrt (* 2/3 (pow x 3))) (cbrt (* 2/3 (pow x 3)))) (cbrt (* 2/3 (pow x 3)))) (- 2 (pow x 2)))
55.0ms
(cbrt (* 2/3 (pow x 3)))

simplify496.0ms

Counts
20 → 62
Calls

20 calls. Slowest were:

130.0ms
(* (exp (* (* (cbrt (* 2/3 (pow x 3))) (cbrt (* 2/3 (pow x 3)))) (cbrt (* 2/3 (pow x 3))))) (exp (- 2 (pow x 2))))
106.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
105.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

prune741.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.5b

regimes210.0ms

Accuracy

96.2% (0.6b remaining)

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

bsearch553.0ms

end0.0ms

sample11.5s

Algorithm
intervals