Front page | perl.perl5.porters |
Postings from June 2001
Re: Report /pro/3gl/CPAN/perl-5.7.1
Thread Previous
|
Thread Next
From:
H . Merijn Brand
Date:
June 29, 2001 08:01
Subject:
Re: Report /pro/3gl/CPAN/perl-5.7.1
Message ID:
20010629165920.9DC6.H.M.BRAND@hccnet.nl
On Wed 27 Jun 2001 23:18, Nicholas Clark <nick@ccl4.org> wrote:
> On Wed, Jun 27, 2001 at 04:24:01PM +0100, Mike Guy wrote:
> > Nicholas Clark <nick@ccl4.org> wrote
> > > On Mon, Jun 25, 2001 at 05:27:44PM -0500, Jarkko Hietaniemi wrote:
> > > > NV = 4745162525730
> > > > NV = 4745162525730
> > >
> > > This is crazy. They appear to be the same.
> >
> > Not necessarily. Sneaky stuff, float-to-string conversion. Watch:
>
> > If you want to know reliably the value of an NV, you have to look at more
> > that its printed form. If you know a quantity which is near to the
> > expected value, and which is exactly representable, the simplest
> > trick is to display the difference from that quantity, e.g.
> > displaying $y-4745162525730 in the above example.
>
> Good point. What does the nasty AIX configuration make of:
>
> #!/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);
> Dump($y-4745162525730);
>
> #!/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);
> Dump($y-4745162525730);
# perl-5.7.1-10995 /tmp/xx
ok 13
SV = PVNV(0x2003f358) at 0x20048a88
REFCNT = 1
FLAGS = (NOK,pIOK,pNOK,IsUV)
UV = 4294967295
NV = 4745162525730
PV = 0
SV = PVNV(0x2003f340) at 0x20048aac
REFCNT = 1
FLAGS = (NOK,pIOK,pNOK,IsUV)
UV = 4294967295
NV = 4745162525730
PV = 0
SV = NV(0x2004c930) at 0x20048b84
REFCNT = 1
FLAGS = (PADTMP,NOK,pNOK)
NV = 0
ok 13
SV = PVNV(0x2003f358) at 0x20048a88
REFCNT = 1
FLAGS = (NOK,pNOK)
IV = -1
NV = 4745162525730
PV = 0
SV = PVNV(0x2003f340) at 0x20048aac
REFCNT = 1
FLAGS = (NOK,pIOK,pNOK,IsUV)
UV = 4294967295
NV = 4745162525730
PV = 0
SV = NV(0x2004c950) at 0x2004e144
REFCNT = 1
FLAGS = (PADTMP,NOK,pNOK)
NV = 0
--
H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/)
using perl-5.6.1, 5.7.1 & 626 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Thread Previous
|
Thread Next