Average Error: 14.2 → 0.3
Time: 34.7s
Precision: 64
Internal Precision: 128
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{1}{(x \cdot x + -1)_*} \cdot -2\]

Error

Bits error versus x

Derivation

  1. Initial program 14.2

    \[\frac{1}{x + 1} - \frac{1}{x - 1}\]
  2. Using strategy rm
  3. Applied flip--29.1

    \[\leadsto \frac{1}{x + 1} - \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x + 1}}}\]
  4. Applied associate-/r/29.2

    \[\leadsto \frac{1}{x + 1} - \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)}\]
  5. Applied flip-+14.3

    \[\leadsto \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}}} - \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
  6. Applied associate-/r/14.2

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)} - \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
  7. Applied distribute-lft-out--13.6

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)}\]
  8. Simplified13.6

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

    \[\leadsto \frac{1}{(x \cdot x + -1)_*} \cdot \color{blue}{-2}\]
  10. Final simplification0.3

    \[\leadsto \frac{1}{(x \cdot x + -1)_*} \cdot -2\]

Reproduce

herbie shell --seed 2019016 +o rules:numerics
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))

Details

Time bar (total: 34.0s)Debug log

sample72.0ms

Algorithm
intervals
Results
256×(pre true 80)
132×(body real 80)
58×(body real 640)
34×(body real 160)
32×(body real 320)

simplify11.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
11.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 14.5b

localize40.0ms

Local error

Found 3 expressions with local error:

3.5b
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
0.0b
(/ 1 (- x 1))
0.0b
(/ 1 (+ x 1))

rewrite18.0ms

Algorithm
rewrite-expression-head
Rules
36×prod-diff
32×associate-/r/
22×*-un-lft-identity
20×add-sqr-sqrt
19×div-inv
18×add-cube-cbrt
flip--
flip-+
flip3--
flip3-+
fma-neg
associate-/r*
add-log-exp
distribute-lft-out--
add-exp-log
pow1
log1p-expm1-u
add-cbrt-cube
expm1-log1p-u
inv-pow
pow-flip
frac-2neg
clear-num
rec-exp
difference-of-squares
frac-sub
diff-log
sub-neg
Counts
3 → 103
Calls
3 calls:
Slowest
12.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
2.0ms
(/ 1 (- x 1))
2.0ms
(/ 1 (+ x 1))

series60.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
40.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
10.0ms
(/ 1 (+ x 1))
10.0ms
(/ 1 (- x 1))

simplify18.1s

Counts
108 → 112
Calls
108 calls:
Slowest
1.4s
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
1.1s
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
988.0ms
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
910.0ms
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
900.0ms
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))

prune896.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.1b

localize19.0ms

Local error

Found 1 expressions with local error:

0.1b
(/ 1 (fma x x -1))

rewrite1.0ms

Algorithm
rewrite-expression-head
Rules
associate-/r*
add-cube-cbrt
add-exp-log
*-un-lft-identity
pow1
add-sqr-sqrt
add-log-exp
inv-pow
pow-flip
div-inv
log1p-expm1-u
add-cbrt-cube
frac-2neg
clear-num
rec-exp
expm1-log1p-u
Counts
1 → 18
Calls
1 calls:
Slowest
1.0ms
(/ 1 (fma x x -1))

series16.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
16.0ms
(/ 1 (fma x x -1))

simplify106.0ms

Counts
7 → 21
Calls
7 calls:
Slowest
63.0ms
(- (+ (pow x 2) (+ (pow x 4) 1)))
21.0ms
(+ (/ 1 (pow x 4)) (+ (/ 1 (pow x 6)) (/ 1 (pow x 2))))
12.0ms
(+ (/ 1 (pow x 4)) (+ (/ 1 (pow x 6)) (/ 1 (pow x 2))))
3.0ms
(sqrt (fma x x -1))
3.0ms
(cbrt (fma x x -1))

prune185.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize19.0ms

Local error

Found 4 expressions with local error:

14.9b
(cbrt (fma x x -1))
14.9b
(cbrt (fma x x -1))
14.9b
(cbrt (fma x x -1))
1.0b
(/ 1 (* (cbrt (fma x x -1)) (cbrt (fma x x -1))))

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
10×pow1
cbrt-prod
pow-flip
add-cube-cbrt
add-exp-log
pow1/3
*-un-lft-identity
add-sqr-sqrt
add-log-exp
log1p-expm1-u
add-cbrt-cube
expm1-log1p-u
pow-prod-up
pow-prod-down
rec-exp
inv-pow
div-inv
prod-exp
pow-plus
frac-2neg
associate-/r*
clear-num
pow2
Counts
4 → 62
Calls
4 calls:
Slowest
5.0ms
(/ 1 (* (cbrt (fma x x -1)) (cbrt (fma x x -1))))
1.0ms
(cbrt (fma x x -1))
1.0ms
(cbrt (fma x x -1))
1.0ms
(cbrt (fma x x -1))

series530.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
163.0ms
(/ 1 (* (cbrt (fma x x -1)) (cbrt (fma x x -1))))
126.0ms
(cbrt (fma x x -1))
121.0ms
(cbrt (fma x x -1))
120.0ms
(cbrt (fma x x -1))

simplify1.4s

Counts
29 → 74
Calls
29 calls:
Slowest
198.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
190.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
184.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
117.0ms
(- (pow (/ 1 x) -2/3) (+ (* 1/9 (pow (/ 1 (pow x 10)) 1/3)) (* 1/3 (pow (/ 1 (pow x 4)) 1/3))))
107.0ms
(- (pow (/ -1 x) -2/3) (+ (* 1/9 (pow (/ 1 (pow x 10)) 1/3)) (* 1/3 (pow (/ 1 (pow x 4)) 1/3))))

prune755.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.0b

localize11.0ms

Local error

Found 4 expressions with local error:

14.9b
(cbrt (fma x x -1))
14.9b
(cbrt (fma x x -1))
0.2b
(pow (cbrt (fma x x -1)) -2)
0.1b
(/ (pow (cbrt (fma x x -1)) -2) (cbrt (fma x x -1)))

rewrite10.0ms

Algorithm
rewrite-expression-head
Rules
60×cbrt-prod
54×times-frac
49×add-cube-cbrt
49×*-un-lft-identity
49×add-sqr-sqrt
48×unpow-prod-down
10×add-exp-log
associate-/l*
associate-/r*
pow1
add-cbrt-cube
add-log-exp
log1p-expm1-u
expm1-log1p-u
div-exp
pow1/3
pow-exp
pow-pow
pow-to-exp
pow-div
div-inv
frac-2neg
clear-num
cbrt-undiv
Counts
4 → 131
Calls
4 calls:
Slowest
6.0ms
(/ (pow (cbrt (fma x x -1)) -2) (cbrt (fma x x -1)))
1.0ms
(pow (cbrt (fma x x -1)) -2)
1.0ms
(cbrt (fma x x -1))
1.0ms
(cbrt (fma x x -1))

series395.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
144.0ms
(pow (cbrt (fma x x -1)) -2)
114.0ms
(cbrt (fma x x -1))
114.0ms
(cbrt (fma x x -1))
22.0ms
(/ (pow (cbrt (fma x x -1)) -2) (cbrt (fma x x -1)))

simplify7.2s

Counts
155 → 143
Calls
155 calls:
Slowest
243.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
197.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
131.0ms
(/ (* (* (pow (cbrt (fma x x -1)) -2) (pow (cbrt (fma x x -1)) -2)) (pow (cbrt (fma x x -1)) -2)) (fma x x -1))
123.0ms
(- (pow (/ 1 x) -2/3) (+ (* 1/9 (pow (/ 1 (pow x 10)) 1/3)) (* 1/3 (pow (/ 1 (pow x 4)) 1/3))))
120.0ms
(- (pow (/ -1 x) -2/3) (+ (* 1/9 (pow (/ 1 (pow x 10)) 1/3)) (* 1/3 (pow (/ 1 (pow x 4)) 1/3))))

prune1.7s

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 0b

regimes74.0ms

Accuracy

0% (0.1b remaining)

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

bsearch2.0ms

end0.0ms

sample2.4s

Algorithm
intervals
Results
8000×(pre true 80)
4202×(body real 80)
1895×(body real 640)
1225×(body real 320)
678×(body real 160)