Average Error: 14.2 → 0.1
Time: 7.9s
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.2

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

    \[\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 2019018 
(FPCore (x)
  :name "2frac (problem 3.3.1)"
  (- (/ 1 (+ x 1)) (/ 1 x)))

Details

Time bar (total: 7.5s)Debug log

sample32.0ms

Algorithm
intervals
Results
12.0ms65×body640valid
6.0ms127×body80valid
6.0ms41×body320valid
2.0ms23×body160valid

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: 18.1b

localize10.0ms

Local error

Found 1 expressions with local error:

3.9b
(- (/ 1 (+ x 1)) (/ 1 x))

rewrite5.0ms

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

series11.0ms

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

simplify263.0ms

Counts
12 → 21
Calls
12 calls:
Slowest
56.0ms
(- (* 1 x) (* (+ x 1) 1))
39.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
37.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
33.0ms
(- 1 (+ x (/ 1 x)))
29.0ms
(/ (exp (/ 1 (+ x 1))) (exp (/ 1 x)))

prune159.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.2b

localize11.0ms

Local error

Found 1 expressions with local error:

0.2b
(/ -1 (* (+ x 1) x))

rewrite2.0ms

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

series17.0ms

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

simplify152.0ms

Counts
5 → 16
Calls
5 calls:
Slowest
55.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
39.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
30.0ms
(+ (* x x) (- (* 1 1) (* x 1)))
25.0ms
(- 1 (+ x (/ 1 x)))
2.0ms
(- x 1)

prune130.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

localize10.0ms

Local error

Found 1 expressions with local error:

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

rewrite5.0ms

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

series14.0ms

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

simplify240.0ms

Counts
7 → 20
Calls
7 calls:
Slowest
71.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
60.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
53.0ms
(- 1 (+ x (/ 1 x)))
44.0ms
(/ -1 (- (* x x) (* 1 1)))
5.0ms
(* (cbrt (/ -1 (+ x 1))) (cbrt (/ -1 (+ x 1))))

prune172.0ms

Pruning

5 alts after pruning (2 fresh and 3 done)

Merged error: 0.0b

localize26.0ms

Local error

Found 4 expressions with local error:

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

rewrite15.0ms

Algorithm
rewrite-expression-head
Rules
30×cbrt-prod
11×add-cube-cbrt
11×*-un-lft-identity
11×add-sqr-sqrt
10×associate-/r/
associate-*l*
associate-*r*
pow1
pow1/3
cbrt-div
add-exp-log
div-inv
flip-+
flip3-+
add-log-exp
add-cbrt-cube
pow-prod-up
pow-prod-down
cbrt-unprod
*-commutative
associate-*r/
prod-exp
associate-*l/
pow-plus
frac-times
pow2
Counts
4 → 82
Calls
4 calls:
Slowest
10.0ms
(* (cbrt (/ -1 (+ x 1))) (cbrt (/ -1 (+ x 1))))
1.0ms
(cbrt (/ -1 (+ x 1)))
1.0ms
(cbrt (/ -1 (+ x 1)))
1.0ms
(cbrt (/ -1 (+ x 1)))

series301.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
85.0ms
(cbrt (/ -1 (+ x 1)))
81.0ms
(cbrt (/ -1 (+ x 1)))
68.0ms
(cbrt (/ -1 (+ x 1)))
67.0ms
(* (cbrt (/ -1 (+ x 1))) (cbrt (/ -1 (+ x 1))))

simplify3.3s

Counts
63 → 94
Calls
63 calls:
Slowest
404.0ms
(- (+ (* 2/9 (* (pow x 2) (cbrt -1))) (cbrt -1)) (* 1/3 (* x (cbrt -1))))
365.0ms
(- (+ (* 2/9 (* (pow x 2) (cbrt -1))) (cbrt -1)) (* 1/3 (* x (cbrt -1))))
327.0ms
(- (+ (* 2/9 (* (pow x 2) (cbrt -1))) (cbrt -1)) (* 1/3 (* x (cbrt -1))))
300.0ms
(- (+ (* (pow (/ 1 (pow x 2)) 1/3) (pow (cbrt -1) 2)) (* 5/9 (* (pow (/ 1 (pow x 8)) 1/3) (pow (cbrt -1) 2)))) (* 2/3 (* (pow (/ 1 (pow x 5)) 1/3) (pow (cbrt -1) 2))))
293.0ms
(- (+ (* (pow (/ 1 (pow x 2)) 1/3) (pow (cbrt -1) 2)) (* 5/9 (* (pow (/ 1 (pow x 8)) 1/3) (pow (cbrt -1) 2)))) (* 2/3 (* (pow (/ 1 (pow x 5)) 1/3) (pow (cbrt -1) 2))))

prune899.0ms

Pruning

6 alts after pruning (2 fresh and 4 done)

Merged error: 0b

regimes74.0ms

Accuracy

0% (0.1b remaining)

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

bsearch2.0ms

end0.0ms

sample1.7s

Algorithm
intervals
Results
950.0ms1866×body640valid
320.0ms4259×body80valid
276.0ms1239×body320valid
84.0ms640×body160valid