Rampal Etienne on Fri, 10 Jun 2005 13:56:57 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

precision question


Dear all,

I have a problem with precision in PARI.
Suppose we have default(realprecision,30).
Then PARI gives

> 1E+0 - 1E+0
0.E-38

Is it possible to get

> 1E+0 - 1E+0
0

instead?

In other words, if I want to calculate 1E+0 - 1E+0 + 1E-40, I want to get 1E-40 and not 0.E-38 which is the answer PARI gives me right now. This is important, because in a PARI program it could occur that the difference of exactly the same number is taken (e.g. log(10/2) - log(2+3) + 1E-40), which then gives the wrong answer.

Rampal