develooper Front page | perl.perl5.porters | Postings from June 2001

Re: Report /pro/3gl/CPAN/perl-5.7.1

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
June 25, 2001 15:02
Subject:
Re: Report /pro/3gl/CPAN/perl-5.7.1
Message ID:
20010625230202.A18199@plum.flirble.org
On Sun, Jun 24, 2001 at 05:02:00PM -0500, Jarkko Hietaniemi wrote:
> > > AIX 4.3      stdio/perlio     -Duseperlio -Duselongdouble
> > > AIX 4.3      stdio/perlio     -DDEBUGGING -Duseperlio -Duselongdouble
> > >     op/int..........................FAILED at test 13
> > 
> > not ok 13 # int(279964589018079/59) is 4745162525730, not 4745162525730
> > 
> > With added Devel::Peek::Dump on $y and 4745162525730:
> > 
> > SV = PVNV(0x20062338) at 0x200480cc
> >   REFCNT = 1
> >   FLAGS = (NOK,POK,pIOK,pNOK,pPOK,IsUV)
> >   UV = 4294967295
> >   NV = 4745162525730
> >   PV = 0x2003d268 "4745162525730"\0
> >   CUR = 13
> >   LEN = 35
> > SV = NV(0x20046fe8) at 0x2004a9c4
> >   REFCNT = 1
> >   FLAGS = (NOK,READONLY,pNOK)
> >   NV = 4745162525730
> > 
> > HUH?

What happens if you write it as

#!/usr/bin/perl -w
$x = 4745162525730;
$y = int(279964589018079/59);
if ($y == $x) {
  print "ok 13\n"
} else {
  print "not ok 13 # int(279964589018079/59) is $y, not $x\n";
}
use Devel::Peek;
Dump($x);
Dump($y);

and also reverse the test as

#!/usr/bin/perl -w
$x = 4745162525730;
$y = int(279964589018079/59);
if ($x == $y) {
  print "ok 13\n"
} else {
  print "not ok 13 # int(279964589018079/59) is $y, not $x\n";
}
use Devel::Peek;
Dump($x);
Dump($y);

?

It isn't making much sense at the moment. I had thought it might be
rounding (with two floating point values that print the same, but actually
are different.) But that looks unlikely.

> It seems that the compile-time evalulation of constants leaves the
> IsUV flag on at all times, even when the resulting constant cannot
> be an UV anymore:

I don't think there is a problem with what perl is up to
[but I may be misunderstanding what you say]

> tcsh ibmsp01e:/tmp/jhi/perl ; ./perl -Ilib -MDevel::Peek -le 'Dump(4294967295/1)'
> SV = PVNV(0x2005b328) at 0x2003722c
>   REFCNT = 1
>   FLAGS = (IOK,NOK,READONLY,pIOK,pNOK,IsUV)
>   UV = 4294967295
>   NV = 4294967295
>   PV = 0
> tcsh ibmsp01e:/tmp/jhi/perl ; ./perl -Ilib -MDevel::Peek -le 'Dump(4294967296/1)'
> SV = PVNV(0x2005b328) at 0x2003722c
>   REFCNT = 1
>   FLAGS = (NOK,READONLY,pIOK,pNOK,IsUV)
>   UV = 4294967295
>   NV = 4294967296
>   PV = 0

IsUV && pIOK means that the IV slot is holding a UV, not an IV. privately.
Not for public consumption.

> tcsh ibmsp01e:/tmp/jhi/perl ; ./perl -Ilib -V:uvsizeuvsize='4';
> uvsize='4';
> tcsh ibmsp01e:/tmp/jhi/perl ; ./perl -Ilib -MDevel::Peek -le 'Dump(4294967296)'SV = NV(0x20048368) at 0x200371f0
>   REFCNT = 1
>   FLAGS = (NOK,READONLY,pNOK)
>   NV = 4294967296
> tcsh ibmsp01e:/tmp/jhi/perl ; 

Publicly this one is just the same as the previous. NV = 4294967296
That's all. Anyone reading into what the private value of the IV slot might
be is nosey.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About