Bill Allombert on Sat, 29 Jan 2005 12:44:24 +0100

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

 Re: Pari/GP 2-2-9.exe bug report

```On Thu, Jan 27, 2005 at 01:34:54PM -0500, John Nicol wrote:
> Hi there,
>
> I noticed the following behavior(s) which seem buggy to me.  This is Pari-GP 2-2-9.exe.  I am running Windows XP Professional with 1GB of memory.
>
> #1:  Factoring above and beyond 2^122 seems to encounter problems.
> (10:18) gp > factor(2^122 -1)
>   *** factor: tempfile /tmp/FREL.400.3056 already exists.

Factoring large integers use the MPQS code that rely on temporary files
to store data. does the file '/tmp/FREL.400.3056' exists on your system?

> #2:  contfrac(sqrt(x)) and contfrac(sqrt(x),n) terminate earlier than I would expect from definition.  Rounding error?
> This is a quadratic surd, with infinitely many terms and period 2.  Here I'm expecting arbitrarily many terms, but I only get 31.
>
> (10:30) gp > contfrac(sqrt(15))
> %22 = [3, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7]
> (10:30) gp > contfrac(sqrt(15),,300)
> %23 = [3, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7]

This is not a bug: sqrt(15) is a 28 decimal approximation of the square
root of 15, but is also a 28 decimal approximation of lots of other real
numbers. contfrac() will return only terms that are common to all those
numbers.

Cheers,
Bill.

```