Bug#1732: Bad arithmetic in new perl packages (fwd)
Forwarded message:
>From alegre@mars.superlink.net Mon Oct 23 17:47:44 1995
Date: Mon, 23 Oct 1995 12:47:22 -0400 (EDT)
From: Fernando <alegre@mars.superlink.net>
To: "J.H.M.Dassen" <jdassen@WI.LeidenUniv.NL>
Subject: Re: Bug#1732: Bad arithmetic in new perl packages
In-Reply-To: <[🔎] 199510221657.QAA21984@ind143a.wi.leidenuniv.nl>
Message-ID: <Pine.SGI.3.91.951023124508.27119A-100000@mars.superlink.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
While trying to isolate the bug in perl-5.001-5 I managed to reproduce it
also with perl-5.001-3, although the output is not exactly the same.
I have tried the script below in two machines (a 386SX and a 486DX) with
the same result. It seems to be some conversion problem. It happens more
often in perl-5.001m because I noticed when I upgraded and my scripts
started to fail.
This is the test script:
------------------------------------------------------------
#!/usr/bin/perl
@array=(
"item1 4 units",
"item2 1.5 units",
"item3 8 units + see item2"
);
foreach (@array) {
if( ($item_name,$amount,$unit,$delimiter,$moreinfo)=
/^(\w+)\s*([\d\.]+)\s*(\w+)\s*(\+|$)\s*(.*)/) {
$total+=$amount;
}
}
$Total=$total;
print "total=$total\n";
print "Total=$Total\n";
-----------------------------------------------------------------
Output from perl-5.001-5:
total=13.5
Total=13.5000000003576
Output from perl-5.001-3:
total=13.5
Total=13.5000000005364
Thanks,
Fernando.
--
J.H.M. Dassen | RUMOUR Believe all you hear. Your world may
jDassen@wi.LeidenUniv.Nl | not be a better one than the one the blocks
Dassen@stpc.wi.LeidenUniv.Nl | live in but it'll be a sight more vivid.
| - The Hipcrime Vocab by Chad C. Mulligan
Reply to: