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

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

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
June 25, 2001 15:27
Subject:
Re: Report /pro/3gl/CPAN/perl-5.7.1
Message ID:
20010625172744.B21832@chaos.wustl.edu
> 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.

tcsh ibmsp01e:/tmp/jhi/perl/t ; ./perl -I../lib x
not ok 13 # int(279964589018079/59) is 4745162525730, not 4745162525730
SV = PVNV(0x2005c5d8) at 0x20041f84
  REFCNT = 1
  FLAGS = (NOK,POK,pIOK,pNOK,pPOK,IsUV)
  UV = 4294967295
  NV = 4745162525730
  PV = 0x2003d2d8 "4745162525730"\0
  CUR = 13
  LEN = 35
SV = PVNV(0x2005c5b8) at 0x20041fa8
  REFCNT = 1
  FLAGS = (NOK,POK,pIOK,pNOK,pPOK,IsUV)
  UV = 4294967295
  NV = 4745162525730
  PV = 0x2003d258 "4745162525730"\0
  CUR = 13
  LEN = 35
tcsh ibmsp01e:/tmp/jhi/perl/t ; ./perl -I../lib y
not ok 13 # int(279964589018079/59) is 4745162525730, not 4745162525730
SV = PVNV(0x2005c5d8) at 0x20041f84
  REFCNT = 1
  FLAGS = (NOK,POK,pNOK,pPOK)
  IV = -1
  NV = 4745162525730
  PV = 0x2003d2d8 "4745162525730"\0
  CUR = 13
  LEN = 35
SV = PVNV(0x2005c5b8) at 0x20041fa8
  REFCNT = 1
  FLAGS = (NOK,POK,pIOK,pNOK,pPOK,IsUV)
  UV = 4294967295
  NV = 4745162525730
  PV = 0x2003d258 "4745162525730"\0
  CUR = 13
  LEN = 35
tcsh ibmsp01e:/tmp/jhi/perl/t ;

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

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