Average Error: 14.3 → 0.4
Time: 29.4s
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.3

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

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

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

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

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

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

    \[\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 2019022 +o rules:numerics
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))

Details

Time bar (total: 28.9s)Debug log

sample46.0ms

Algorithm
intervals
Results
15.0ms55×body640valid
10.0ms135×body80valid
9.0ms45×body320valid
3.0ms21×body160valid

simplify11.0ms

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

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 15.0b

localize31.0ms

Local error

Found 3 expressions with local error:

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

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

series52.0ms

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

simplify17.9s

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.0s
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
978.0ms
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
952.0ms
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
914.0ms
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))

prune710.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.1b

localize18.0ms

Local error

Found 2 expressions with local error:

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

rewrite8.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
5.0ms
(* (/ 1 (fma x x -1)) -2)
2.0ms
(/ 1 (fma x x -1))

series33.0ms

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

simplify1.7s

Counts
13 → 39
Calls
13 calls:
Slowest
740.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
729.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
87.0ms
(+ (* 2 (pow x 2)) (+ (* 2 (pow x 4)) 2))
77.0ms
(- (+ (pow x 2) (+ (pow x 4) 1)))
53.0ms
(* (cbrt (/ 1 (fma x x -1))) (cbrt (/ 1 (fma x x -1))))

prune285.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.1b

localize15.0ms

Local error

Found 4 expressions with local error:

14.0b
(cbrt (fma x x -1))
14.0b
(cbrt (fma x x -1))
14.0b
(cbrt (fma x x -1))
0.5b
(/ 1 (* (cbrt (fma x x -1)) (cbrt (fma x x -1))))

rewrite13.0ms

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

series454.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
134.0ms
(/ 1 (* (cbrt (fma x x -1)) (cbrt (fma x x -1))))
110.0ms
(cbrt (fma x x -1))
107.0ms
(cbrt (fma x x -1))
102.0ms
(cbrt (fma x x -1))

simplify1.5s

Counts
29 → 74
Calls
29 calls:
Slowest
240.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
222.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
206.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
110.0ms
(- (pow (/ -1 x) -2/3) (+ (* 1/9 (pow (/ 1 (pow x 10)) 1/3)) (* 1/3 (pow (/ 1 (pow x 4)) 1/3))))
109.0ms
(- (pow (/ 1 x) -2/3) (+ (* 1/9 (pow (/ 1 (pow x 10)) 1/3)) (* 1/3 (pow (/ 1 (pow x 4)) 1/3))))

prune858.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.1b

localize24.0ms

Local error

Found 4 expressions with local error:

14.0b
(cbrt (fma x x -1))
14.0b
(cbrt (fma x x -1))
14.0b
(cbrt (fma x x -1))
14.0b
(cbrt (fma x x -1))

rewrite3.0ms

Algorithm
rewrite-expression-head
Rules
12×cbrt-prod
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
log1p-expm1-u
add-exp-log
pow1/3
add-cbrt-cube
pow1
expm1-log1p-u
Counts
4 → 52
Calls
4 calls:
Slowest
1.0ms
(cbrt (fma x x -1))
1.0ms
(cbrt (fma x x -1))
1.0ms
(cbrt (fma x x -1))
1.0ms
(cbrt (fma x x -1))

series463.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
122.0ms
(cbrt (fma x x -1))
118.0ms
(cbrt (fma x x -1))
117.0ms
(cbrt (fma x x -1))
105.0ms
(cbrt (fma x x -1))

simplify1.8s

Counts
24 → 64
Calls
24 calls:
Slowest
253.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
246.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
202.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
184.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
127.0ms
(- (pow (/ -1 x) -2/3) (+ (* 1/9 (pow (/ 1 (pow x 10)) 1/3)) (* 1/3 (pow (/ 1 (pow x 4)) 1/3))))

prune864.0ms

Pruning

5 alts after pruning (2 fresh and 3 done)

Merged error: 0.1b

regimes42.0ms

Accuracy

0% (0.0b remaining)

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

bsearch2.0ms

end0.0ms

sample2.0s

Algorithm
intervals
Results
1.0s1841×body640valid
457.0ms4232×body80valid
287.0ms1289×body320valid
159.0ms638×body160valid