Karim Belabas on Sat, 11 Sep 2004 18:17:26 +0200


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

Re: 64bit regression


* Igor Schein [2004-09-07 18:33]:
> On Tue, Sep 07, 2004 at 06:03:50PM +0200, Bill Allombert wrote:
>> On Tue, Sep 07, 2004 at 11:33:14AM -0400, Igor Schein wrote:
>> > Hi,
>> >
>> >           GP/PARI CALCULATOR Version 2.2.8 (development CHANGES-1.998)
>> >    UltraSparc running solaris (portable C kernel) 64-bit version -- debugging
>> >                         compiled: Sep  7 2004, gcc-3.4.1
>> >             (readline not compiled in, extended help not available)
>> >    echo = 1 (on)
>> > ? intnum(x=0,Pi,sin(x),1)
>> >
>> > Never converges.
>> >
>> > This comes right out of sumiter bench.
>>
>> Could you compile the program below on that box and send me the output ?
>>
>> Cheers,
>> Bill.
>>
>> #include <math.h>
>> typedef unsigned long ulong;
>> main()
>> {
>>     ulong a=18446744073709551431UL;
>>     double beta=sqrt((double)a);
>>     double p=beta*(1UL << 32);
>>     ulong u = (ulong) p;
>>     long l= (long) p;
>>     printf("beta=%g\np=%g\nu=%lu\nl=%ld\n",beta,p,u,l);
>>     return 0;
>> }
>
> beta=4.29497e+09
> p=1.84467e+19
> u=9223372036854775807
> l=9223372036854775807

Hi,

  I had made a mistake in my "guess" for the semantics of the typecast
double --> ulong. The "mod 2^64" rule does not apply and (ulong)p is
undefined by the IEEE standard if p = 2^64.

I believe the above is now fixed. Can you check that the 64-bit version
is OK now ?

Thanks,

    Karim.

P.S: Many thanks to Vincent Lefevre & Bill Allombert for their help.
--
Karim Belabas                     Tel: (+33) (0)1 69 15 57 48
Dep. de Mathematiques, Bat. 425   Fax: (+33) (0)1 69 15 60 19
Universite Paris-Sud              http://www.math.u-psud.fr/~belabas/
F-91405 Orsay (France)            http://pari.math.u-bordeaux.fr/  [PARI/GP]