kynn on Wed, 05 Oct 2005 13:22:38 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Fwd: Incorrect conversion of unnormalized IEEE doubles |
In our lab we use PARI via the Perl module Math::Pari. Recently I discovered a bug in the way the Math::Pari::PARI function converts unnormalized IEEE doubles into PARI reals (see bug report below, and also at the listed URL). The author of Math::Pari (Ilya Zakharevich) is of the opinion that the bug is in the underlying PARI library (see correspondence below). I was not able to find mention of this bug at http://pari.math.u-bordeaux.fr/Bugs/, but on the other hand I was not able to determine what versions numbers correspond to the "pari-stable" and "pari" options in that page, so it is possible that the version I am using, which is quite old (2.1.3), is not covered in these bug reports and that the bug I'm referring to was already fixed in "pari-stable". Anyway, if any of you is able to reproduce the bug in the PARI versions corresponding to the "pari-stable" or "pari" options, please let me know, and I'll send in a formal bug report. You can find more details about my machine's architecture, OS, etc., at http://rt.cpan.org/NoAuth/Bug.html?id=14891. Regards, KJ ====================================================================== Subject: Re: [cpan #14891] Incorrect conversion of unnormalized IEEE doubles From: "Ilya Zakharevich via RT" <comment-Math-Pari@rt.cpan.org> Reply-To: comment-Math-Pari@rt.cpan.org RT-Ticket: cpan #14891 To: kynn@panix.com Date: Tue, 4 Oct 2005 21:58:07 -0400 (EDT) Full context and any attached attachments can be found at: <URL: http://rt.cpan.org/NoAuth/Bug.html?id=14891 > On Mon, Oct 03, 2005 at 12:19:11PM -0400, kynn@panix.com via RT wrote: > Math::Pari produces wrong results when it converts unnormalized IEEE > doubles to PARI reals. For example > > print POSIX::DBL_MIN()/2 > 1.1125369292536e-308 > > ...while > > print Math::Pari::PARI( POSIX::DBL_MIN()/2 ) > 1.668805393880401037E-308 > > ...which is actually POSIX::DBL_MIN*(3/4). This represents a relative > error of 50%, which is far from negligible. > > It appears that Math::Pari::PARI is converting numbers of the form > > POSIX::DBL_MIN()/2**$n > > (where $n is a positive integer) into numbers of the form > > POSIX::DBL_MIN()*((2**$n)-1)/(2**(-$n-1)) Thanks for a great bug report? Could you also produce a great bug fix? ;-) The problem is (IIRC) that Math::Pari uses a PARI API which (apparently) is very rarely used otherwise. So I would think it is a GP/PARI bug exposed by Math::Pari... Thanks, Ilya ------- End of forwarded message -------