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

Error

Bits error versus x

Derivation

  1. Initial program 14.4

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

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

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

    \[\leadsto \frac{-1}{\color{blue}{(x \cdot x + x)_*}}\]
  6. Using strategy rm
  7. Applied add-sqr-sqrt16.4

    \[\leadsto \frac{-1}{\color{blue}{\sqrt{(x \cdot x + x)_*} \cdot \sqrt{(x \cdot x + x)_*}}}\]
  8. Applied associate-/r*16.4

    \[\leadsto \color{blue}{\frac{\frac{-1}{\sqrt{(x \cdot x + x)_*}}}{\sqrt{(x \cdot x + x)_*}}}\]
  9. Using strategy rm
  10. Applied *-un-lft-identity16.4

    \[\leadsto \frac{\frac{-1}{\sqrt{(x \cdot x + x)_*}}}{\sqrt{\color{blue}{1 \cdot (x \cdot x + x)_*}}}\]
  11. Applied sqrt-prod16.4

    \[\leadsto \frac{\frac{-1}{\sqrt{(x \cdot x + x)_*}}}{\color{blue}{\sqrt{1} \cdot \sqrt{(x \cdot x + x)_*}}}\]
  12. Applied div-inv16.4

    \[\leadsto \frac{\color{blue}{-1 \cdot \frac{1}{\sqrt{(x \cdot x + x)_*}}}}{\sqrt{1} \cdot \sqrt{(x \cdot x + x)_*}}\]
  13. Applied times-frac16.4

    \[\leadsto \color{blue}{\frac{-1}{\sqrt{1}} \cdot \frac{\frac{1}{\sqrt{(x \cdot x + x)_*}}}{\sqrt{(x \cdot x + x)_*}}}\]
  14. Simplified16.4

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

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

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

Reproduce

herbie shell --seed 2019010 +o rules:numerics
(FPCore (x)
  :name "2frac (problem 3.3.1)"
  (- (/ 1 (+ x 1)) (/ 1 x)))

Details

Time bar (total: 9.7s)Debug log

sample66.0ms

Algorithm
intervals

simplify10.0ms

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

prune8.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 15.9b

localize22.0ms

Local error

Found 2 expressions with local error:

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

rewrite16.0ms

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

series42.0ms

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

simplify3.7s

Counts
73 → 76
Calls
73 calls:
Slowest
506.0ms
(fma (/ 1 (+ (pow x 3) (pow 1 3))) (+ (* x x) (- (* 1 1) (* x 1))) (- (* (/ 1 x) 1)))
475.0ms
(fma (/ 1 (+ (pow x 3) (pow 1 3))) (+ (* x x) (- (* 1 1) (* x 1))) (- (* (sqrt (/ 1 x)) (sqrt (/ 1 x)))))
403.0ms
(fma (/ 1 (+ (pow x 3) (pow 1 3))) (+ (* x x) (- (* 1 1) (* x 1))) (- (* (/ 1 x) 1)))
234.0ms
(fma (/ 1 (- (* x x) (* 1 1))) (- x 1) (- (* (cbrt (/ 1 x)) (* (cbrt (/ 1 x)) (cbrt (/ 1 x))))))
204.0ms
(fma (/ 1 (- (* x x) (* 1 1))) (- x 1) (- (* (sqrt (/ 1 x)) (sqrt (/ 1 x)))))

prune538.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.2b

localize14.0ms

Local error

Found 1 expressions with local error:

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

rewrite1.0ms

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

series18.0ms

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

simplify155.0ms

Counts
6 → 18
Calls
6 calls:
Slowest
50.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
49.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
49.0ms
(- 1 (+ x (/ 1 x)))
3.0ms
(sqrt (fma x x x))
3.0ms
(cbrt (fma x x x))

prune131.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.2b

localize16.0ms

Local error

Found 4 expressions with local error:

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

rewrite10.0ms

Algorithm
rewrite-expression-head
Rules
27×add-sqr-sqrt
25×add-cube-cbrt
25×*-un-lft-identity
24×sqrt-prod
24×times-frac
12×associate-/r*
div-inv
add-exp-log
add-cbrt-cube
add-log-exp
associate-/l*
log1p-expm1-u
pow1
expm1-log1p-u
pow1/2
frac-2neg
clear-num
rem-sqrt-square
associate-/l/
div-exp
cbrt-undiv
Counts
4 → 95
Calls
4 calls:
Slowest
5.0ms
(/ (/ -1 (sqrt (fma x x x))) (sqrt (fma x x x)))
2.0ms
(sqrt (fma x x x))
2.0ms
(sqrt (fma x x x))
1.0ms
(/ -1 (sqrt (fma x x x)))

series96.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
35.0ms
(/ -1 (sqrt (fma x x x)))
25.0ms
(/ (/ -1 (sqrt (fma x x x))) (sqrt (fma x x x)))
20.0ms
(sqrt (fma x x x))
16.0ms
(sqrt (fma x x x))

simplify2.2s

Counts
84 → 107
Calls
84 calls:
Slowest
271.0ms
(/ (* (* (/ -1 (sqrt (fma x x x))) (/ -1 (sqrt (fma x x x)))) (/ -1 (sqrt (fma x x x)))) (* (* (sqrt (fma x x x)) (sqrt (fma x x x))) (sqrt (fma x x x))))
189.0ms
(- (+ (* 3/8 (/ 1 (pow x 3))) (/ 1 x)) (* 1/2 (/ 1 (pow x 2))))
179.0ms
(- (* 1/2 (/ 1 (pow x 2))) (+ (* 3/8 (/ 1 (pow x 3))) (/ 1 x)))
83.0ms
(- (+ x 1/2) (* 1/8 (/ 1 x)))
82.0ms
(- (+ x 1/2) (* 1/8 (/ 1 x)))

prune914.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.2b

localize9.0ms

Local error

Found 1 expressions with local error:

0.3b
(/ 1 (fma x x x))

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 x))

series11.0ms

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

simplify131.0ms

Counts
7 → 21
Calls
7 calls:
Slowest
60.0ms
(- (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))) (/ 1 (pow x 3)))
47.0ms
(- (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))) (/ 1 (pow x 3)))
17.0ms
(- (+ x (/ 1 x)) 1)
1.0ms
(cbrt (fma x x x))
1.0ms
(sqrt (fma x x x))

prune135.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.2b

regimes49.0ms

Accuracy

0% (0.1b remaining)

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

bsearch3.0ms

end0.0ms

sample1.5s

Algorithm
intervals