Average Error: 14.4 → 0.1
Time: 4.0s
Precision: 64
Internal Precision: 128
\[\frac{1}{x + 1} - \frac{1}{x}\]
\[\frac{\frac{-1}{x + 1}}{x}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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. Using strategy rm
  6. Applied associate-/r*0.1

    \[\leadsto \color{blue}{\frac{\frac{-1}{x + 1}}{x}}\]
  7. Final simplification0.1

    \[\leadsto \frac{\frac{-1}{x + 1}}{x}\]

Reproduce

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

Details

Time bar (total: 3.7s)Debug log

sample30.0ms

Algorithm
intervals

simplify5.0ms

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

prune4.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 15.9b

localize17.0ms

Local error

Found 2 expressions with local error:

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

rewrite6.0ms

Algorithm
rewrite-expression-head
Rules
*-un-lft-identity
div-inv
add-sqr-sqrt
add-log-exp
distribute-lft-out--
add-cube-cbrt
add-exp-log
associate-/r*
pow1
associate-/r/
add-cbrt-cube
difference-of-squares
inv-pow
flip--
pow-flip
flip-+
frac-sub
diff-log
flip3--
flip3-+
frac-2neg
sub-neg
clear-num
rec-exp
Counts
2 → 36
Calls
2 calls:
Slowest
5.0ms
(- (/ 1 (+ x 1)) (/ 1 x))
1.0ms
(/ 1 (+ x 1))

series25.0ms

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

simplify455.0ms

Counts
21 → 42
Calls
21 calls:
Slowest
73.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
73.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
51.0ms
(- 1 (+ x (/ 1 x)))
44.0ms
(+ (* x x) (- (* 1 1) (* x 1)))
39.0ms
(- (+ (/ 1 (pow x 3)) (/ 1 x)) (/ 1 (pow x 2)))

prune274.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.2b

localize5.0ms

Local error

Found 2 expressions with local error:

0.3b
(/ -1 (* (+ x 1) x))
0.0b
(* (+ x 1) x)

rewrite4.0ms

Algorithm
rewrite-expression-head
Rules
associate-*l/
add-cube-cbrt
associate-*l*
*-un-lft-identity
add-sqr-sqrt
add-log-exp
flip-+
associate-/r/
add-exp-log
add-cbrt-cube
flip3-+
pow1
div-inv
*-commutative
frac-2neg
associate-/r*
clear-num
Counts
2 → 26
Calls
2 calls:
Slowest
2.0ms
(* (+ x 1) x)
1.0ms
(/ -1 (* (+ x 1) x))

series28.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
19.0ms
(* (+ x 1) x)
9.0ms
(/ -1 (* (+ x 1) x))

simplify294.0ms

Counts
12 → 32
Calls
12 calls:
Slowest
103.0ms
(* (- (* x x) (* 1 1)) x)
46.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
40.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
25.0ms
(+ (* x x) (- (* 1 1) (* x 1)))
25.0ms
(* (+ (pow x 3) (pow 1 3)) x)

prune292.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

localize5.0ms

Local error

Found 2 expressions with local error:

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

rewrite4.0ms

Algorithm
rewrite-expression-head
Rules
associate-/l*
add-cube-cbrt
associate-/r/
*-un-lft-identity
add-sqr-sqrt
div-inv
associate-/r*
add-log-exp
flip-+
add-exp-log
add-cbrt-cube
flip3-+
frac-2neg
clear-num
pow1
associate-/l/
Counts
2 → 32
Calls
2 calls:
Slowest
3.0ms
(/ (/ -1 (+ x 1)) x)
0.0ms
(/ -1 (+ x 1))

series15.0ms

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

simplify429.0ms

Counts
15 → 38
Calls
15 calls:
Slowest
76.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
74.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
51.0ms
(- (/ 1 (pow x 2)) (+ (/ 1 (pow x 3)) (/ 1 x)))
50.0ms
(- 1 (+ x (/ 1 x)))
45.0ms
(- (/ 1 (pow x 2)) (+ (/ 1 (pow x 3)) (/ 1 x)))

prune193.0ms

Pruning

3 alts after pruning (0 fresh and 3 done)

Merged error: 0.0b

regimes45.0ms

Accuracy

0% (0.1b remaining)

Error of 0.1b against oracle of 0.0b and baseline of 0.1b

bsearch1.0ms

end0.0ms

sample1.5s

Algorithm
intervals