Average Error: 14.4 → 0.3
Time: 28.5s
Precision: 64
Internal Precision: 128
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{1}{(x \cdot x + -1)_*} \cdot -2\]

Error

Bits error versus x

Derivation

  1. Initial program 14.4

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

    \[\leadsto \frac{1}{x + 1} - \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x + 1}}}\]
  4. Applied associate-/r/28.6

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

    \[\leadsto \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}}} - \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
  6. Applied associate-/r/14.4

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)} - \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
  7. Applied distribute-lft-out--13.8

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)}\]
  8. Simplified13.8

    \[\leadsto \color{blue}{\frac{1}{(x \cdot x + -1)_*}} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)\]
  9. Simplified0.3

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

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

Reproduce

herbie shell --seed 2019010 +o rules:numerics
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))

Details

Time bar (total: 27.9s)Debug log

sample71.0ms

Algorithm
intervals

simplify12.0ms

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

prune8.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 15.9b

localize28.0ms

Local error

Found 3 expressions with local error:

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

rewrite33.0ms

Algorithm
rewrite-expression-head
Rules
36×prod-diff
32×associate-/r/
22×*-un-lft-identity
20×add-sqr-sqrt
19×div-inv
18×add-cube-cbrt
flip--
flip-+
flip3--
flip3-+
fma-neg
associate-/r*
add-log-exp
distribute-lft-out--
add-exp-log
pow1
log1p-expm1-u
add-cbrt-cube
expm1-log1p-u
inv-pow
pow-flip
frac-2neg
clear-num
rec-exp
difference-of-squares
frac-sub
diff-log
sub-neg
Counts
3 → 103
Calls
3 calls:
Slowest
15.0ms
(/ 1 (+ x 1))
14.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
2.0ms
(/ 1 (- x 1))

series43.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
27.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
9.0ms
(/ 1 (+ x 1))
6.0ms
(/ 1 (- x 1))

simplify18.0s

Counts
108 → 112
Calls
108 calls:
Slowest
1.4s
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
1.1s
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
1.0s
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
977.0ms
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
923.0ms
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))

prune816.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.3b

localize11.0ms

Local error

Found 2 expressions with local error:

0.3b
(/ 1 (fma x x -1))
0.0b
(* (/ 1 (fma x x -1)) -2)

rewrite4.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
associate-*l*
*-un-lft-identity
add-sqr-sqrt
add-exp-log
associate-/r*
pow1
add-log-exp
div-inv
log1p-expm1-u
add-cbrt-cube
expm1-log1p-u
inv-pow
pow-flip
*-commutative
associate-*l/
frac-2neg
clear-num
rec-exp
Counts
2 → 33
Calls
2 calls:
Slowest
3.0ms
(* (/ 1 (fma x x -1)) -2)
1.0ms
(/ 1 (fma x x -1))

series30.0ms

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

simplify1.8s

Counts
13 → 39
Calls
13 calls:
Slowest
751.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
715.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
111.0ms
(+ (* 2 (pow x 2)) (+ (* 2 (pow x 4)) 2))
75.0ms
(* (cbrt (/ 1 (fma x x -1))) (cbrt (/ 1 (fma x x -1))))
59.0ms
(- (+ (pow x 2) (+ (pow x 4) 1)))

prune305.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.2b

localize23.0ms

Local error

Found 4 expressions with local error:

12.8b
(cbrt (/ 1 (fma x x -1)))
12.8b
(cbrt (/ 1 (fma x x -1)))
12.8b
(cbrt (/ 1 (fma x x -1)))
0.3b
(/ 1 (fma x x -1))

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
12×cbrt-prod
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-exp-log
pow1
add-log-exp
div-inv
log1p-expm1-u
add-cbrt-cube
expm1-log1p-u
pow1/3
associate-/r*
cbrt-div
inv-pow
pow-flip
frac-2neg
clear-num
rec-exp
Counts
4 → 63
Calls
4 calls:
Slowest
2.0ms
(/ 1 (fma x x -1))
1.0ms
(cbrt (/ 1 (fma x x -1)))
1.0ms
(cbrt (/ 1 (fma x x -1)))
1.0ms
(cbrt (/ 1 (fma x x -1)))

series432.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
146.0ms
(cbrt (/ 1 (fma x x -1)))
134.0ms
(cbrt (/ 1 (fma x x -1)))
131.0ms
(cbrt (/ 1 (fma x x -1)))
21.0ms
(/ 1 (fma x x -1))

simplify1.1s

Counts
31 → 75
Calls
31 calls:
Slowest
198.0ms
(+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (+ (* 2/9 (* (pow x 4) (pow -1 1/3))) (pow -1 1/3)))
149.0ms
(+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (+ (* 2/9 (* (pow x 4) (pow -1 1/3))) (pow -1 1/3)))
131.0ms
(+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (+ (* 2/9 (* (pow x 4) (pow -1 1/3))) (pow -1 1/3)))
83.0ms
(cbrt (* (cbrt (/ 1 (fma x x -1))) (cbrt (/ 1 (fma x x -1)))))
67.0ms
(- (+ (pow x 2) (+ (pow x 4) 1)))

prune833.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.2b

localize13.0ms

Local error

Found 4 expressions with local error:

13.0b
(cbrt (fma x x -1))
12.8b
(cbrt (/ 1 (fma x x -1)))
12.8b
(cbrt (/ 1 (fma x x -1)))
0.3b
(/ 1 (fma x x -1))

rewrite4.0ms

Algorithm
rewrite-expression-head
Rules
11×cbrt-prod
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-exp-log
pow1
add-log-exp
log1p-expm1-u
add-cbrt-cube
expm1-log1p-u
div-inv
pow1/3
associate-/r*
cbrt-div
inv-pow
pow-flip
frac-2neg
clear-num
rec-exp
Counts
4 → 61
Calls
4 calls:
Slowest
1.0ms
(/ 1 (fma x x -1))
1.0ms
(cbrt (/ 1 (fma x x -1)))
1.0ms
(cbrt (/ 1 (fma x x -1)))
1.0ms
(cbrt (fma x x -1))

series404.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
137.0ms
(cbrt (/ 1 (fma x x -1)))
125.0ms
(cbrt (/ 1 (fma x x -1)))
122.0ms
(cbrt (fma x x -1))
20.0ms
(/ 1 (fma x x -1))

simplify1.2s

Counts
29 → 73
Calls
29 calls:
Slowest
232.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
165.0ms
(+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (+ (* 2/9 (* (pow x 4) (pow -1 1/3))) (pow -1 1/3)))
131.0ms
(+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (+ (* 2/9 (* (pow x 4) (pow -1 1/3))) (pow -1 1/3)))
118.0ms
(- (pow (/ -1 x) -2/3) (+ (* 1/9 (pow (/ 1 (pow x 10)) 1/3)) (* 1/3 (pow (/ 1 (pow x 4)) 1/3))))
102.0ms
(- (pow (/ 1 x) -2/3) (+ (* 1/9 (pow (/ 1 (pow x 10)) 1/3)) (* 1/3 (pow (/ 1 (pow x 4)) 1/3))))

prune966.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.2b

regimes49.0ms

Accuracy

0% (0.0b remaining)

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

bsearch2.0ms

end0.0ms

sample1.8s

Algorithm
intervals