Average Error: 15.1 → 0.1
Time: 13.7s
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 15.1

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

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

Details

Time bar (total: 12.9s)Debug log

sample75.0ms

Algorithm
intervals
Results
30.0ms62×body640valid
16.0ms134×body80valid
15.0ms41×body320valid
5.0ms19×body160valid

simplify11.0ms

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

prune9.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 15.8b

localize29.0ms

Local error

Found 2 expressions with local error:

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

rewrite14.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
12.0ms
(- (/ 1 (+ x 1)) (/ 1 x))
2.0ms
(/ 1 (+ x 1))

series35.0ms

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

simplify631.0ms

Counts
21 → 42
Calls
21 calls:
Slowest
95.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
89.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
64.0ms
(- (+ (/ 1 (pow x 3)) (/ 1 x)) (/ 1 (pow x 2)))
64.0ms
(- (+ (/ 1 (pow x 3)) (/ 1 x)) (/ 1 (pow x 2)))
55.0ms
(- 1 (+ x (/ 1 x)))

prune462.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.5b

localize17.0ms

Local error

Found 2 expressions with local error:

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

rewrite10.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
6.0ms
(* (+ x 1) x)
3.0ms
(/ -1 (* (+ x 1) x))

series59.0ms

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

simplify485.0ms

Counts
12 → 32
Calls
12 calls:
Slowest
141.0ms
(* (- (* x x) (* 1 1)) x)
84.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
83.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
59.0ms
(- 1 (+ x (/ 1 x)))
56.0ms
(+ (* x x) (- (* 1 1) (* x 1)))

prune360.0ms

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 2 expressions with local error:

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

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

series31.0ms

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

simplify568.0ms

Counts
15 → 38
Calls
15 calls:
Slowest
85.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
82.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
82.0ms
(- (/ 1 (pow x 2)) (+ (/ 1 (pow x 3)) (/ 1 x)))
78.0ms
(- (/ 1 (pow x 2)) (+ (/ 1 (pow x 3)) (/ 1 x)))
57.0ms
(/ -1 (- (* x x) (* 1 1)))

prune422.0ms

Pruning

6 alts after pruning (3 fresh and 3 done)

Merged error: 0.0b

localize31.0ms

Local error

Found 4 expressions with local error:

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

rewrite17.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
11.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)))

series452.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
134.0ms
(* (cbrt (/ -1 (+ x 1))) (cbrt (/ -1 (+ x 1))))
111.0ms
(cbrt (/ -1 (+ x 1)))
105.0ms
(cbrt (/ -1 (+ x 1)))
101.0ms
(cbrt (/ -1 (+ x 1)))

simplify4.8s

Counts
63 → 94
Calls
63 calls:
Slowest
489.0ms
(- (+ (* 2/9 (* (pow x 2) (cbrt -1))) (cbrt -1)) (* 1/3 (* x (cbrt -1))))
485.0ms
(- (+ (* 2/9 (* (pow x 2) (cbrt -1))) (cbrt -1)) (* 1/3 (* x (cbrt -1))))
484.0ms
(- (+ (* 2/9 (* (pow x 2) (cbrt -1))) (cbrt -1)) (* 1/3 (* x (cbrt -1))))
480.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))))
472.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))))

prune1.4s

Pruning

7 alts after pruning (3 fresh and 4 done)

Merged error: 0b

regimes133.0ms

Accuracy

0% (0.1b remaining)

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

bsearch2.0ms

end0.0ms

sample2.8s

Algorithm
intervals
Results
1.1s1976×body640valid
516.0ms4133×body80valid
453.0ms1252×body320valid
188.0ms639×body160valid