Bugs item #1789069, was opened at 2007-09-05 18:34
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=107940&aid=1789069&group_id=7940

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: MacPerl Application
Group: Development Branch
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: precision error with bank transactions

Initial Comment:
hard to believe perl actually has a bug in adding up 31 bank transactions, but 
here it is:

#!/usr/bin/perl

use strict;

open (f,"<LTM");
my $i=0;
my $bal=0.0;
while(<f>) {
        chomp;
        ++$i;
        print $i,": $bal + $_ = ";
        $bal+= $_;
        print $bal, "\n";
}
close(f);


LTM:
-40.47
-5.01
-61.12
-351.89
-392.33
-101.89
-33.80
-11.12
2859.26
-13.03
-72.98
-10.20
-31.71
-31.71
-957.00
-10.13
-13.96
-31.50
-43.50
-46.15
-11.28
-60.00
-89.01
-10.07
4.80
-166.75
-7.38
-18.01
-43.38
-64.59
-66.09

RESULTS:
1: 0 + -40.47 = -40.47
2: -40.47 + -5.01 = -45.48
3: -45.48 + -61.12 = -106.6
4: -106.6 + -351.89 = -458.49
5: -458.49 + -392.33 = -850.82
6: -850.82 + -101.89 = -952.71
7: -952.71 + -33.80 = -986.51
8: -986.51 + -11.12 = -997.63
9: -997.63 + 2859.26 = 1861.63
10: 1861.63 + -13.03 = 1848.6
11: 1848.6 + -72.98 = 1775.62
12: 1775.62 + -10.20 = 1765.42
13: 1765.42 + -31.71 = 1733.71
14: 1733.71 + -31.71 = 1702
15: 1702 + -957.00 = 745
16: 745 + -10.13 = 734.87
17: 734.87 + -13.96 = 720.91
18: 720.91 + -31.50 = 689.41
19: 689.41 + -43.50 = 645.91
20: 645.91 + -46.15 = 599.76
21: 599.76 + -11.28 = 588.48
22: 588.48 + -60.00 = 528.48
23: 528.48 + -89.01 = 439.47
24: 439.47 + -10.07 = 429.4
25: 429.4 + 4.80 = 434.2
26: 434.2 + -166.75 = 267.45
27: 267.45 + -7.38 = 260.07
28: 260.07 + -18.01 = 242.06
29: 242.06 + -43.38 = 198.68
30: 198.68 + -64.59 = 134.09
31: 134.09 + -66.09 = 68.0000000000003


perl -v

This is perl, v5.8.8 built for darwin-thread-multi-2level
(with 10 registered patches, see perl -V for more detail)
...

uname -a
Darwin ip70-179-74-207.dc.dc.cox.net 8.10.0 Darwin Kernel Version 8.10.0: Wed 
May 23 16:50:59 PDT 2007; root:xnu-792.21.3~1/RELEASE_PPC Power Macintosh 
powerpc


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=107940&aid=1789069&group_id=7940

Reply via email to