Average Error: 14.3 → 0.3
Time: 8.5s
Precision: 64
Internal Precision: 128
\[\frac{1}{x + 1} - \frac{1}{x}\]
\[\frac{-1}{\left(x + 1\right) \cdot 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.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. Final simplification0.3

    \[\leadsto \frac{-1}{\left(x + 1\right) \cdot x}\]

Reproduce

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

Details

Time bar (total: 8.2s)Debug log

sample42.0ms

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

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

localize11.0ms

Local error

Found 2 expressions with local error:

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

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

series36.0ms

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

simplify381.0ms

Counts
21 → 42
Calls
21 calls:
Slowest
60.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
59.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
45.0ms
(- (+ (/ 1 (pow x 3)) (/ 1 x)) (/ 1 (pow x 2)))
30.0ms
(- (+ (/ 1 (pow x 3)) (/ 1 x)) (/ 1 (pow x 2)))
28.0ms
(/ (exp (/ 1 (+ x 1))) (exp (/ 1 x)))

prune317.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.1b

localize5.0ms

Local error

Found 2 expressions with local error:

0.1b
(/ -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
3.0ms
(* (+ x 1) x)
1.0ms
(/ -1 (* (+ x 1) x))

series27.0ms

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

simplify267.0ms

Counts
12 → 32
Calls
12 calls:
Slowest
74.0ms
(* (- (* x x) (* 1 1)) x)
52.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
37.0ms
(+ (* x x) (- (* 1 1) (* x 1)))
36.0ms
(- (/ 1 (pow x 3)) (+ (/ 1 (pow x 4)) (/ 1 (pow x 2))))
25.0ms
(- 1 (+ x (/ 1 x)))

prune230.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.0b

localize10.0ms

Local error

Found 2 expressions with local error:

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

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

series30.0ms

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

simplify407.0ms

Counts
15 → 38
Calls
15 calls:
Slowest
67.0ms
(- (/ 1 (pow x 2)) (+ (/ 1 (pow x 3)) (/ 1 x)))
61.0ms
(- (/ 1 (pow x 2)) (+ (/ 1 (pow x 3)) (/ 1 x)))
57.0ms
(/ -1 (- (* x x) (* 1 1)))
52.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))))

prune249.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 4 expressions with local error:

15.2b
(cbrt (* (+ x 1) x))
15.2b
(cbrt (* (+ x 1) x))
15.2b
(cbrt (* (+ x 1) x))
0.5b
(* (cbrt (* (+ x 1) x)) (cbrt (* (+ x 1) x)))

rewrite16.0ms

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

series245.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
70.0ms
(* (cbrt (* (+ x 1) x)) (cbrt (* (+ x 1) x)))
67.0ms
(cbrt (* (+ x 1) x))
63.0ms
(cbrt (* (+ x 1) x))
45.0ms
(cbrt (* (+ x 1) x))

simplify3.1s

Counts
49 → 77
Calls
49 calls:
Slowest
330.0ms
(* (* (+ x 1) x) (* (+ x 1) x))
300.0ms
(- (+ (* (pow (pow x 4) 1/3) (pow (cbrt -1) 2)) (* 2/3 (* (pow x 1/3) (pow (cbrt -1) 2)))) (* 1/9 (* (pow (/ 1 (pow x 2)) 1/3) (pow (cbrt -1) 2))))
272.0ms
(* (* (+ x 1) x) (* (+ x 1) x))
212.0ms
(- (+ (* 1/3 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x))))))) x)) (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x)))))))) (* 1/9 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x))))))) (pow x 2))))
194.0ms
(- (+ (* 1/3 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x))))))) x)) (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x)))))))) (* 1/9 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x))))))) (pow x 2))))

prune732.0ms

Pruning

5 alts after pruning (2 fresh and 3 done)

Merged error: 0.0b

regimes50.0ms

Accuracy

0% (0.3b remaining)

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

bsearch2.0ms

end0.0ms

sample2.0s

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