Average Error: 14.4 → 0.4
Time: 42.9s
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.7

    \[\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.9

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

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

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

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

Reproduce

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

Details

Time bar (total: 38.6s)Debug log

start91.0ms

Algorithm
intervals

setup27.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 14.2b

localize26.0ms

Local error

Found 3 expressions with local error:

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

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
3 → 103
Calls

3 calls. Slowest were:

13.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
2.0ms
(/ 1 (+ x 1))
2.0ms
(/ 1 (- x 1))

series52.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

25.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
15.0ms
(/ 1 (- x 1))
12.0ms
(/ 1 (+ x 1))

simplify20.7s

Counts
108 → 112
Calls

108 calls. Slowest were:

1.3s
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
1.2s
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
1.2s
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))

prune979.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.5b

localize16.0ms

Local error

Found 2 expressions with local error:

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

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
2 → 33
Calls

2 calls. Slowest were:

6.0ms
(* (/ 1 (fma x x -1)) -2)
2.0ms
(/ 1 (fma x x -1))

series55.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

29.0ms
(* (/ 1 (fma x x -1)) -2)
25.0ms
(/ 1 (fma x x -1))

simplify2.0s

Counts
13 → 39
Calls

13 calls. Slowest were:

944.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
812.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
115.0ms
(+ (* 2 (pow x 2)) (+ (* 2 (pow x 4)) 2))

prune434.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.5b

localize26.0ms

Local error

Found 4 expressions with local error:

17.7b
(sqrt (fma x x -1))
17.7b
(sqrt (fma x x -1))
0.1b
(/ (/ 1 (sqrt (fma x x -1))) (sqrt (fma x x -1)))
0.0b
(* (/ (/ 1 (sqrt (fma x x -1))) (sqrt (fma x x -1))) -2)

rewrite31.0ms

Algorithm
rewrite-expression-head
Counts
4 → 120
Calls

4 calls. Slowest were:

15.0ms
(* (/ (/ 1 (sqrt (fma x x -1))) (sqrt (fma x x -1))) -2)
9.0ms
(/ (/ 1 (sqrt (fma x x -1))) (sqrt (fma x x -1)))
2.0ms
(sqrt (fma x x -1))

series129.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

37.0ms
(sqrt (fma x x -1))
37.0ms
(sqrt (fma x x -1))
30.0ms
(* (/ (/ 1 (sqrt (fma x x -1))) (sqrt (fma x x -1))) -2)
26.0ms
(/ (/ 1 (sqrt (fma x x -1))) (sqrt (fma x x -1)))

simplify8.6s

Counts
113 → 132
Calls

113 calls. Slowest were:

897.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
821.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
438.0ms
(- (+ (* 1/2 (/ (pow x 2) (sqrt -1))) (sqrt -1)) (* 1/8 (/ (pow x 4) (pow (sqrt -1) 3))))

prune1.4s

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.4b

localize6.0ms

Local error

Found 3 expressions with local error:

17.7b
(sqrt (fma x x -1))
0.0b
(* (pow (sqrt (fma x x -1)) -2) -2)
0.0b
(pow (sqrt (fma x x -1)) -2)

rewrite7.0ms

Algorithm
rewrite-expression-head
Counts
3 → 52
Calls

3 calls. Slowest were:

4.0ms
(* (pow (sqrt (fma x x -1)) -2) -2)
1.0ms
(pow (sqrt (fma x x -1)) -2)
1.0ms
(sqrt (fma x x -1))

series129.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

66.0ms
(pow (sqrt (fma x x -1)) -2)
36.0ms
(sqrt (fma x x -1))
26.0ms
(* (pow (sqrt (fma x x -1)) -2) -2)

simplify3.1s

Counts
30 → 61
Calls

30 calls. Slowest were:

825.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
783.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
438.0ms
(- (+ (* 1/2 (/ (pow x 2) (sqrt -1))) (sqrt -1)) (* 1/8 (/ (pow x 4) (pow (sqrt -1) 3))))

prune673.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.0b

regimes19.0ms

Accuracy

0% (0.4b remaining)

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

bsearch1.0ms