Average Error: 14.3 → 0.3
Time: 12.0s
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.3

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

    \[\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. Final simplification0.3

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

Reproduce

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

Details

Time bar (total: 11.5s)Debug log

sample67.0ms

Algorithm
intervals
Results
256×(pre true 80)
131×(body real 80)
57×(body real 640)
35×(body real 160)
33×(body real 320)

simplify10.0ms

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

prune4.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 14.5b

localize10.0ms

Local error

Found 2 expressions with local error:

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

rewrite28.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
24.0ms
(- (/ 1 (+ x 1)) (/ 1 x))
3.0ms
(/ 1 (+ x 1))

series28.0ms

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

simplify3.6s

Counts
73 → 76
Calls
73 calls:
Slowest
489.0ms
(fma (/ 1 (+ (pow x 3) (pow 1 3))) (+ (* x x) (- (* 1 1) (* x 1))) (- (* (sqrt (/ 1 x)) (sqrt (/ 1 x)))))
460.0ms
(fma (/ 1 (+ (pow x 3) (pow 1 3))) (+ (* x x) (- (* 1 1) (* x 1))) (- (* (/ 1 x) 1)))
380.0ms
(fma (/ 1 (+ (pow x 3) (pow 1 3))) (+ (* x x) (- (* 1 1) (* x 1))) (- (* (/ 1 x) 1)))
210.0ms
(fma (/ 1 (- (* x x) (* 1 1))) (- x 1) (- (* (/ 1 x) 1)))
195.0ms
(fma (/ 1 (- (* x x) (* 1 1))) (- x 1) (- (* (sqrt (/ 1 x)) (sqrt (/ 1 x)))))

prune595.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.1b

localize13.0ms

Local error

Found 1 expressions with local error:

0.1b
(/ -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))

series19.0ms

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

simplify152.0ms

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

prune152.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 4 expressions with local error:

15.2b
(cbrt (fma x x x))
15.2b
(cbrt (fma x x x))
15.2b
(cbrt (fma x x x))
1.1b
(/ -1 (* (cbrt (fma x x x)) (cbrt (fma x x x))))

rewrite7.0ms

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

series198.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
56.0ms
(/ -1 (* (cbrt (fma x x x)) (cbrt (fma x x x))))
53.0ms
(cbrt (fma x x x))
53.0ms
(cbrt (fma x x x))
36.0ms
(cbrt (fma x x x))

simplify864.0ms

Counts
22 → 64
Calls
22 calls:
Slowest
108.0ms
(- (* 2/3 (pow (/ 1 (pow x 7)) 1/3)) (+ (* 5/9 (pow (/ 1 (pow x 10)) 1/3)) (pow (/ 1 (pow x 4)) 1/3)))
80.0ms
(- (* 2/3 (pow x 1/3)) (+ (pow (/ 1 (pow x 2)) 1/3) (* 5/9 (pow (pow x 4) 1/3))))
72.0ms
(- (+ (* 1/3 (pow (/ 1 x) 1/3)) (pow (/ -1 x) -2/3)) (* 1/9 (pow (/ 1 (pow x 4)) 1/3)))
71.0ms
(- (+ (* 1/3 (pow (pow x 4) 1/3)) (pow x 1/3)) (* 1/9 (pow (pow x 7) 1/3)))
69.0ms
(- (+ (* 1/3 (pow (pow x 4) 1/3)) (pow x 1/3)) (* 1/9 (pow (pow x 7) 1/3)))

prune613.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.0b

localize16.0ms

Local error

Found 4 expressions with local error:

14.4b
(sqrt (fma x x x))
14.4b
(sqrt (fma x x x))
0.2b
(/ (/ -1 (sqrt (fma x x x))) (sqrt (fma x x x)))
0.1b
(/ -1 (sqrt (fma x x x)))

rewrite19.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
9.0ms
(/ (/ -1 (sqrt (fma x x x))) (sqrt (fma x x x)))
5.0ms
(sqrt (fma x x x))
2.0ms
(sqrt (fma x x x))
1.0ms
(/ -1 (sqrt (fma x x x)))

series75.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
24.0ms
(sqrt (fma x x x))
24.0ms
(/ -1 (sqrt (fma x x x)))
15.0ms
(sqrt (fma x x x))
12.0ms
(/ (/ -1 (sqrt (fma x x x))) (sqrt (fma x x x)))

simplify2.5s

Counts
84 → 107
Calls
84 calls:
Slowest
432.0ms
(- (* 1/8 (/ 1 x)) (+ x 1/2))
299.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))))
230.0ms
(- (* 1/2 (/ 1 (pow x 2))) (+ (* 3/8 (/ 1 (pow x 3))) (/ 1 x)))
218.0ms
(- (+ (* 3/8 (/ 1 (pow x 3))) (/ 1 x)) (* 1/2 (/ 1 (pow x 2))))
92.0ms
(- (+ x 1/2) (* 1/8 (/ 1 x)))

prune836.0ms

Pruning

5 alts after pruning (2 fresh and 3 done)

Merged error: 0.0b

regimes23.0ms

Accuracy

0% (0.1b remaining)

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

bsearch0.0ms

end0.0ms

sample1.7s

Algorithm
intervals
Results
8004×(pre true 80)
4205×(body real 80)
1895×(body real 640)
1224×(body real 320)
680×(body real 160)