Philippe Elbaz-Vincent on Mon, 2 Apr 2001 09:15:16 +0200 (CEST)


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

Re: [GP/PARI-2.1.0] arithmetic weirdness


On Mon, 2 Apr 2001, Gerhard Niklasch wrote:

> > %1 = 172755.0099999999999999999999
> > (01:24) gp >
>
> Where's the problem here?

because what you see is not what you expect.

Indeed the simple

(09:30) gp > .1
time = 0 ms.
%25 = 0.09999999999999999999999999999

is already surprising for me, since again I expected exact
floating point arithmetic as long as I'm reasonably far from
"computational limitation for a given realprecision"
(it's in general what you observe with most of the systems,
and also for example with a calculator. But as a fact Magma has
also a peculiar behavior)


And what I find again more disturbing is

(09:37) gp > .5-5*.1
time = 0 ms.
%33 = 1.26217744 E-29

of course all the above is consistent with your explanations and with
the internal representation. And it's pretty interesting from a teaching
point of view. But from a "production point of view" it's not, and it's
PARI-specific in the sense that it's related to the implementation
choices (and often you need to justify such choices when you want to do
advocacy for PARI, or when presenting your computations).

Thanks for your(=Igor and You) answers.

all the best, Ph.

Laboratoire Geometrie-Topologie et Algebre. UMR CNRS 5030.
E-mail: pev@pev.math.univ-montp2.fr | Phone: +33 (0)467143958
http://www.math.univ-montp2.fr/~pev | Fax: +33 (0)467143558