Karim BELABAS on Tue, 5 Nov 2002 16:57:39 +0100 (MET)


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

Re: bug in pari-gp precision?


On Mon, 4 Nov 2002, Bill Allombert wrote:
> On Mon, Nov 04, 2002 at 12:31:13PM -0500, Walter Neumann wrote:
> >
> > I just came across another (the same?) problem (current CVS):
> >
> > ? 2.0^100 - 10^-29 - 2.0^100
> > %1 = 32.0000000
>
> Well I am not sure it is a bug but:
>
> ? 2.0^100
> %4 = 1.267650600228229401496703205 E30
> ? \x
> [&=080e21ec] REAL(lg=5,CLONE):05000005  (+,expo=100):40800064  80000000  00000000  00000000
> ? 2.0^100-10^-29
> %3 = 1.267650600228229401496703205 E30
> ? \x
> [&=080e213c] REAL(lg=5,CLONE):05000005  (+,expo=100):40800064  80000000  00000000  00000001
>
> The last bit change seems suspicious to me.

It is a bug. I've recently introduced proper rounding in affrr / affir
routines [2.2.5, C-4], and left a typo in affir: when determining the
rounding direction, I was not checking the right bit in one special case.

>> Admittedly, this is a big improvement over the 2.1.4 release:
>>
>> (12:15) gp > 2.0^100-10^-29+2.0^100
>> %1 = 2.535301200456458802993406410 E30
>
> If you really enter +2.0^100 the result is correct...
> With the same release
> ? 2.0^100-10^-29-2.0^100
> %1 = 0.E2
>
> > But in both cases 0. or less would be nicer!
> So 2.1.4 is OK, but 2.2.5 is broken.

It is fixed now.

    Karim.
-- 
Karim Belabas                    Tel: (+33) (0)1 69 15 57 48
Dép. de Mathematiques, Bat. 425  Fax: (+33) (0)1 69 15 60 19
Université Paris-Sud             Email: Karim.Belabas@math.u-psud.fr
F-91405 Orsay (France)           http://www.math.u-psud.fr/~belabas/
--
PARI/GP Home Page: http://www.parigp-home.de/