Skip Menu |

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

Report information
The Basics
Id: 14143
Status: new
Priority: 0/
Queue: Math-Pari

People
Owner: Nobody in particular
Requestors: kynn [...] DO_THE_panix_OBVIOUS.com.INVALID
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.010603
Fixed in: (no value)



Subject: Mixed < fails after abs (ditto for >)
For some pairs of operands of which exactly one is a PARI float, the >, >=, <, and <= operations fail after one applies abs to the PARI operand. The following short program illustrates the problem. Note that, that after the call to abs, the expressions 1E-17 > 0.1 and 1E-17 >= 0.1 evaluate to true, while 1E-17 < 0.1 and 1E-17 <= 0.1 evaluate to false. Also note that these operations work correctly before the call to abs. ========================================================================= use strict; use warnings; use Math::Pari; my $x = PARI( 1E-17 ); my $y = 1E-01; printf "x: $x is a << %s >>\n", ref $x; printf "y: $y is a << %s >>\n", ref $y; printf "x < y = %d\n", $x < $y; printf "x <= y = %d\n", $x <= $y; printf "x > y = %d\n", $x > $y; printf "x >= y = %d\n", $x >= $y; printf "x == y = %d\n", $x == $y; print "\n"; { my $z = abs( $y ); } printf "x: $x is a << %s >>\n", ref $x; printf "y: $y is a << %s >>\n", ref $y; printf "x < y = %d\n", $x < $y; printf "x <= y = %d\n", $x <= $y; printf "x > y = %d\n", $x > $y; printf "x >= y = %d\n", $x >= $y; printf "x == y = %d\n", $x == $y; __END__ x: 1.000000000000000071E-17 is a << Math::Pari >> y: 0.1 is a << >> x < y = 1 x <= y = 1 x > y = 0 x >= y = 0 x == y = 0 x: 1.000000000000000071E-17 is a << Math::Pari >> y: 0.1 is a << >> x < y = 0 x <= y = 0 x > y = 1 x >= y = 1 x == y = 0 ========================================================================= This is on Linux (Debian Woody). System details follow. Site configuration information for perl v5.8.6: Configured by kynn at Tue Apr 12 12:24:11 EDT 2005. Summary of my perl5 (revision 5 version 8 subversion 6) configuration: Platform: osname=linux, osvers=2.4.18-686-smp, archname=i686-linux-ld uname='linux luna 2.4.18-686-smp #1 smp sun apr 14 12:07:19 est 2002 i686 unknown ' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=define usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='2.95.4 20011002 (Debian prerelease)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='long double', nvsize=12, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm -ldbm -ldb -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.2.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Locally applied patches: --- @INC for perl v5.8.6: /home/kynn/local/lib/perl/my /home/kynn/local/lib/perl/5.8.4 /home/kynn/local/lib/perl/5.6.1 /home/kynn/local/lib/perl5/5.8.6/i686-linux-ld /home/kynn/local/lib/perl5/5.8.6 /home/kynn/local/lib/perl5/i686-linux-ld /home/kynn/local/lib/perl5 /home/kynn/local/lib/perl5/5.8.6/i686-linux-ld /home/kynn/local/lib/perl5/5.8.6 /home/kynn/local/lib/perl5/site_perl/5.8.6/i686-linux-ld /home/kynn/local/lib/perl5/site_perl/5.8.6 /home/kynn/local/lib/perl5/site_perl . --- Environment for perl v5.8.6: HOME=/home/kynn LANG=C LANGUAGE (unset) LD_LIBRARY_PATH=/home/kynn/local/lib:/opt/java/jdk/lib/i386 LOGDIR (unset) PATH=.:/home/kynn/local/bin:/home/kynn/local/usr/bin:/home/kynn/local/local/bin:/bin- \ :/usr/bin:/usr/local/bin:/usr/X11R6/bin:/home/kynn/java/javacc/bin:/opt/java/jdk/bin- \ :/usr/pbs/bin:/home/kynn/opt/ant/bin PERL5LIB=/home/kynn/local/lib/perl/my:/home/kynn/local/lib/perl/5.8.4:/home/kynn/loc- \ al/lib/perl/5.6.1:/home/kynn/local/lib/perl5 PERL5_CPANPLUS_CONFIG=/home/kynn/.cpanplus/config PERL_BADLANG (unset) SHELL=/usr/bin/zsh
From: kynn [...] DO_THE_panix_OBVIOUS.com.INVALID
[guest - Sat Aug 13 08:54:26 2005]: Show quoted text
> For some pairs of operands of which exactly one is a PARI float, the
> >, >=, <, and <= operations fail after one applies abs to the PARI
^^^^^^^^^^^ Show quoted text
> operand. The following short program illustrates the problem.
^^^^^^^^ SORRY! That was a typo. I should have written "the non-PARI operand"! kynn
Date: Wed, 17 Aug 2005 06:40:00 -0700
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
To: Guest via RT <bug-Math-Pari [...] rt.cpan.org>
Subject: Re: [cpan #14143] Mixed < fails after abs (ditto for >)
RT-Send-Cc:
On Sat, Aug 13, 2005 at 08:54:26AM -0400, Guest via RT wrote: Show quoted text
> For some pairs of operands of which exactly one is a PARI float, the >, >=, <, and <= operations fail after one applies abs to the PARI
operand. The following short program illustrates the problem. Note that, that after the call to abs, the expressions 1E-17 > 0.1 and 1E-17 >= 0.1 evaluate to true, while 1E-17 < 0.1 and 1E-17 <= 0.1 evaluate to false. Also note that these operations work correctly before the call to abs. [Please press Enter time to time; I needed to reformat your message. Thanks] powdermilk:~->perl -MDevel::Peek -wle 'my $a=1e-1; print Dump $a; my $b = abs $a; print Dump $a' SV = NV(0x14d8d8) at 0x13b5dc REFCNT = 1 FLAGS = (PADBUSY,PADMY,NOK,pNOK) NV = 0.1 SV = PVNV(0x166308) at 0x13b5dc REFCNT = 1 FLAGS = (PADBUSY,PADMY,NOK,pIOK,pNOK) IV = 0 NV = 0.1 PV = 0 Apparently, pIOK flag is confusing Math::Pari, and it thinks that it may trust the IV value. The meaning of pIOK flag changed some time ago. I need to find exactly *when*, and make the treatement conditional on Perl version.... Thanks for a report. Sigh, Ilya