Karim Belabas on Mon, 27 Jun 2005 21:24:33 +0200


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

Re: strange contfrac behavior


* Phil Carmody [2005-06-26 12:12]:
> --- Alain SMEJKAL <a.smejkal@free.fr> wrote:
> > I cannot make sense of these tests (Version 2.2.11 (development)),
> > especially the first one :
> > 
> > ? F7=2^2^7+1;
> > 
> > ? \p140
> >    realprecision = 144 significant digits (140 digits displayed)
> > ? contfrac(2*sqrt(F7))
> >   *** contfrac: impossible assignment I-->I
> 
> Looks like that appeared between:
> <<<
> phil@nonospaz:dev$ /usr/local/bin/gp-2.2
> Reading GPRC: /home/phil/.gprc ...Done.
> 
>                     GP/PARI CALCULATOR Version 2.2.7 (alpha)
>            i686 running linux (ix86/GMP-4.1.2 kernel) 32-bit version
>                    compiled: Jan 11 2004, gcc-3.3.2 (Debian)
>                 (readline v4.3 enabled, extended help available)
> [...]
> (12:03) gp > F7=2^2^7+1;
> (12:04) gp > \p140
>    realprecision = 144 significant digits (140 digits displayed)
> (12:04) gp > contfrac(2*sqrt(F7))
> %2 = [36893488147419103232, 18446744073709551616, 73786976294838206464,
> 18446744073709551616]
> >>>
> 
> and
> 
> <<<
> phil@nonospaz:dev$ gp
> Reading GPRC: /home/phil/.gprc ...Done.
> 
>           GP/PARI CALCULATOR Version 2.2.8 (development CHANGES-1.999)
>                 i686 running linux (ix86 kernel) 32-bit version
>            compiled: Sep  9 2004, gcc-3.3.4 (Debian 1:3.3.4-6sarge1)
>                 (readline v4.3 enabled, extended help available)
> [...]
> (12:05) gp > F7=2^2^7+1;
> (12:06) gp > \p140
>    realprecision = 144 significant digits (140 digits displayed)
> (12:06) gp > contfrac(2*sqrt(F7))
>   *** contfrac: impossible assignment I-->I
> >>>
> 
> Perhaps someone can binary chop further?

It was due to a mistaken attempt (by me) to save a few words on the stack
(or a copy of the full continued fraction) by an in-place adjustment when
the last computed partial quotient was 1 [ it failed when the previous one
was of the form 2^(32*n) - 1 ... ]

I have fixed the problem in CVS. 

Thanks!

    Karim.
-- 
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]