Average Error: 14.3 → 0.4
Time: 10.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.4

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

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

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

Reproduce

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

Details

Time bar (total: 9.5s)Debug log

sample34.0ms

Algorithm
intervals
Results
10.0ms56×body640valid
8.0ms135×body80valid
6.0ms45×body320valid
2.0ms21×body160valid

simplify17.0ms

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

prune4.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 15.1b

localize11.0ms

Local error

Found 2 expressions with local error:

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

rewrite8.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
6.0ms
(- (/ 1 (+ x 1)) (/ 1 x))
1.0ms
(/ 1 (+ x 1))

series22.0ms

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

simplify3.3s

Counts
73 → 76
Calls
73 calls:
Slowest
430.0ms
(fma (/ 1 (+ (pow x 3) (pow 1 3))) (+ (* x x) (- (* 1 1) (* x 1))) (- (* (sqrt (/ 1 x)) (sqrt (/ 1 x)))))
425.0ms
(fma (/ 1 (+ (pow x 3) (pow 1 3))) (+ (* x x) (- (* 1 1) (* x 1))) (- (* (/ 1 x) 1)))
365.0ms
(fma (/ 1 (+ (pow x 3) (pow 1 3))) (+ (* x x) (- (* 1 1) (* x 1))) (- (* (/ 1 x) 1)))
203.0ms
(fma (/ 1 (- (* x x) (* 1 1))) (- x 1) (- (* (/ 1 x) 1)))
191.0ms
(fma (/ 1 (- (* x x) (* 1 1))) (- x 1) (- (* (cbrt (/ 1 x)) (* (cbrt (/ 1 x)) (cbrt (/ 1 x))))))

prune510.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.1b

localize13.0ms

Local error

Found 1 expressions with local error:

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

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

simplify141.0ms

Counts
6 → 18
Calls
6 calls:
Slowest
51.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
51.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
34.0ms
(- 1 (+ x (/ 1 x)))
2.0ms
(cbrt (fma x x x))
1.0ms
(sqrt (fma x x x))

prune112.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.1b

localize12.0ms

Local error

Found 4 expressions with local error:

14.5b
(cbrt (fma x x x))
14.5b
(cbrt (fma x x x))
14.5b
(cbrt (fma x x x))
0.6b
(/ -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))

series221.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
65.0ms
(cbrt (fma x x x))
55.0ms
(cbrt (fma x x x))
53.0ms
(cbrt (fma x x x))
48.0ms
(/ -1 (* (cbrt (fma x x x)) (cbrt (fma x x x))))

simplify783.0ms

Counts
22 → 64
Calls
22 calls:
Slowest
77.0ms
(- (+ (* 1/3 (pow (/ 1 x) 1/3)) (pow (/ 1 x) -2/3)) (* 1/9 (pow (/ 1 (pow x 4)) 1/3)))
73.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)))
71.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)))
67.0ms
(- (* 2/3 (pow x 1/3)) (+ (pow (/ 1 (pow x 2)) 1/3) (* 5/9 (pow (pow x 4) 1/3))))
66.0ms
(- (+ (* 1/3 (pow (/ 1 x) 1/3)) (pow (/ 1 x) -2/3)) (* 1/9 (pow (/ 1 (pow x 4)) 1/3)))

prune589.0ms

Pruning

6 alts after pruning (3 fresh and 3 done)

Merged error: 0.1b

localize25.0ms

Local error

Found 4 expressions with local error:

14.5b
(cbrt (fma x x x))
14.5b
(cbrt (fma x x x))
14.5b
(cbrt (fma x x x))
14.5b
(cbrt (fma x x x))

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
12×cbrt-prod
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
log1p-expm1-u
add-exp-log
pow1/3
add-cbrt-cube
pow1
expm1-log1p-u
Counts
4 → 52
Calls
4 calls:
Slowest
1.0ms
(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))

series203.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
58.0ms
(cbrt (fma x x x))
54.0ms
(cbrt (fma x x x))
54.0ms
(cbrt (fma x x x))
36.0ms
(cbrt (fma x x x))

simplify759.0ms

Counts
24 → 64
Calls
24 calls:
Slowest
79.0ms
(- (+ (* 1/3 (pow (/ 1 x) 1/3)) (pow (/ -1 x) -2/3)) (* 1/9 (pow (/ 1 (pow x 4)) 1/3)))
79.0ms
(- (+ (* 1/3 (pow (/ 1 x) 1/3)) (pow (/ -1 x) -2/3)) (* 1/9 (pow (/ 1 (pow x 4)) 1/3)))
76.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 (/ 1 x) 1/3)) (pow (/ 1 x) -2/3)) (* 1/9 (pow (/ 1 (pow x 4)) 1/3)))

prune768.0ms

Pruning

6 alts after pruning (2 fresh and 4 done)

Merged error: 0.1b

regimes60.0ms

Accuracy

0% (0.1b remaining)

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

bsearch0.0ms

end0.0ms

sample1.9s

Algorithm
intervals
Results
946.0ms1845×body640valid
374.0ms4232×body80valid
333.0ms1284×body320valid
123.0ms641×body160valid