I encountered a problem with floating point arithmetic that I'm afraid
may be causing greater calculation errors in my program. The program
I'm writing calculates numerical solutions for ordinary differential
equations (http://sid.cwru.edu/perl/euler.pl). What's happening is
that floating point storage is not rounding off properly and down the
line
2.4 + 0.025 = 2.42499999999999 instead of 2.425. You can easily spot
the error in this short script:
my $num = 1;
my $add = 0.025;
while ($num < 4) {
$num += $add;
print $count++ . " $num\n";
}
The resulting error in my particular differential equation is 2/10^15
which is fine exept the the error gets compounded over a few hundred
iterations. Does anyone have any suggestions for how to improve upon
this? I do understand that there are accuracy limitations with floating
pt. nums.
Thanks,
Sid.
-------------------------
Sidharth Malhotra
[EMAIL PROTECTED]