Skip Menu |

This queue is for tickets about the Math-Pari CPAN distribution.

Report information
The Basics
Id: 118659
Status: open
Priority: 0/
Queue: Math-Pari

People
Owner: Nobody in particular
Requestors: peter.john.acklam [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.01080900
Fixed in: (no value)



Subject: sqrtint() output is one too large
I am unsure whether this is a bug in Pari or Math::Pari, but the Pari documentation at http://pari.math.u-bordeaux.fr/dochtml/html/Arithmetic_functions.html says about sqrtint(): "Returns the integer square root of x, i.e. the largest integer y such that y^2 ≤ x, where x a non-negative integer." In that case, the following should return 99999999, not 100000000: $ perl -MMath::Pari -wle '$x = PARI("9999999999999999"); print Math::Pari::sqrtint($x)' 100000000
Subject: Re: [rt.cpan.org #118659] sqrtint() output is one too large
Date: Mon, 7 Nov 2016 09:51:22 -0800
To: Peter John Acklam via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Mon, Nov 07, 2016 at 03:55:46AM -0500, Peter John Acklam via RT wrote: Show quoted text
> I am unsure whether this is a bug in Pari or Math::Pari, but the Pari documentation at http://pari.math.u-bordeaux.fr/dochtml/html/Arithmetic_functions.html says about sqrtint(): > > "Returns the integer square root of x, i.e. the largest integer y such that y^2 ≤ x, where x a non-negative integer." > > In that case, the following should return 99999999, not 100000000: > > $ perl -MMath::Pari -wle '$x = PARI("9999999999999999"); print Math::Pari::sqrtint($x)' > 100000000
I checked with strawberry-perl-5.22.2.1-32bit-PDL, and it returns 99999999, as expected. So one needs more details. Ilya
I am not sure exactly what information you need, but I am running Perl 5.22.2 on the 64 bit version of Cygwin: $ perl -v This is perl 5, version 22, subversion 2 (v5.22.2) built for cygwin-thread-multi (...) $ uname -a CYGWIN_NT-6.1 OSL110 2.6.0(0.304/5/3) 2016-08-31 14:32 x86_64 Cygwin $ gcc --version gcc (GCC) 5.4.0 I built Math::Pari version 2.01080900 through the "cpan" shell, using all the default values. Pari version 2.1.7 was automatically downloaded, built and installed. I'll be happy to provide more information. Just let me know what you need.
Subject: Re: [rt.cpan.org #118659] sqrtint() output is one too large
Date: Tue, 8 Nov 2016 21:17:41 -0800
To: Peter John Acklam via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Tue, Nov 08, 2016 at 09:27:10AM -0500, Peter John Acklam via RT wrote: Show quoted text
> $ perl -v > > This is perl 5, version 22, subversion 2 (v5.22.2) built for cygwin-thread-multi > (...) > > $ uname -a > CYGWIN_NT-6.1 OSL110 2.6.0(0.304/5/3) 2016-08-31 14:32 x86_64 Cygwin > > $ gcc --version > gcc (GCC) 5.4.0 > > I built Math::Pari version 2.01080900 through the "cpan" shell, using all the default values. Pari version 2.1.7 was automatically downloaded, built and installed. > > I'll be happy to provide more information. Just let me know what you need.
For best results, one could try to build GP/PARI under the same compiler with as close as possible 64-bitness flags — and see whether the bug is present there too. Alternatively, try to build version Math-Pari-2.0305_01080607… Myself, I won’t be able to contribute much (at least) the next several months… Thanks, Ilya
For what it is worth... Mac/OS, perl 5.27.2 64-bit. $ perl -MMath::Pari -wle '$x = PARI("9999999999999999"); print Math::Pari::sqrtint($x)," ",$Math::Pari::VERSION;' 100000000 2.01080900 $ perl -Iblib/lib -Iblib/arch -MMath::Pari -wle '$x = PARI("9999999999999999"); print Math::Pari::sqrtint($x)," ",$Math::Pari::VERSION;' 99999999 2.030507 I get similar results with other versions of Perl on this machine. The 2.01080900 version says 100000000, while 2.030507 says 99999999. $perl -Mntheory=:all -wle 'print sqrtint("9999999999999999");' 99999999 $ perl -MMath::BigInt -wle 'print Math::BigInt::bsqrt("9999999999999999");' 99999999 If you think it would help I could try some different versions to verify if this was fixed in a particular build.
CC: ;
Subject: Re: [rt.cpan.org #118659] sqrtint() output is one too large
Date: Thu, 28 Mar 2019 12:36:15 -0700
To: Dana Jacobsen via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Thu, Mar 28, 2019 at 03:19:21PM -0400, Dana Jacobsen via RT wrote: Show quoted text
> For what it is worth... > > Mac/OS, perl 5.27.2 64-bit. > > $ perl -MMath::Pari -wle '$x = PARI("9999999999999999"); print Math::Pari::sqrtint($x)," ",$Math::Pari::VERSION;' > 100000000 2.01080900 > > $ perl -Iblib/lib -Iblib/arch -MMath::Pari -wle '$x = PARI("9999999999999999"); print Math::Pari::sqrtint($x)," ",$Math::Pari::VERSION;' > 99999999 2.030507 > > I get similar results with other versions of Perl on this machine. The 2.01080900 version says 100000000, while 2.030507 says 99999999.
Guys, sorry, I’m lost! Is there anything I can/should do now? It looks like it was broken, but not any more, right? I tested with the latest releases (of yesterday and today), and it gives 99999999, which looks right. Thanks, Ilya
On Thu Mar 28 15:36:29 2019, nospam-abuse@ilyaz.org wrote: Show quoted text
> Is there anything I can/should do now? It looks like it was broken, > but not any more, right? I tested with the latest releases (of > yesterday and today), and it gives 99999999, which looks right.
This seems to be related to Pari, not Math::Pari. The problem is gone with Pari 2.3.*. Perhaps Math::Pari should require Pari 2.3.*?