Skip to content
Prev 206865 / 398503 Next

problem with the precision of numbers

<Ted.Harding <at> manchester.ac.uk> writes:
Just to finish this off: 'Rmpfr' works fine with this example case and 
computes the total sum in less than 2 seconds:

    library(Rmpfr)

    j <- mpfr(-1, 120)
    i <- mpfr(0:2000, 120)
    s <- sum(j^i * 3456 * (1+i*1/2000)^3000)
    s
    # 1 'mpfr' number of precision  120   bits 
    # [1] 2.8876826480125324342665158348085465188e906

which is the same result that Maple returns. But Maple (I admit, mine is
quite old) and 'bc' (couldn't wait for the answer) are much slower at it.

It is said that 'gmp' (on which Rmpfr is based) is faster than any other
multi-precison library "on earth" --- seems to be true.

Hans Werner