Hello ikegami,
Unfortunately, this thread became an accuracy problem/solution discussion.
My original intent was to discuss the Perl beginner's question of " Why isn't Perl as accurate as my calculator? "
Any experienced programmer, engineer, scientist, etc. understands the problems associated with base n arithmetic. The problem for the new user of any programming language ( Perl preferred ) is '...why does Perl give me 1.999999999999999, when my simple calculator gives me the *correct* answer of 2." They really don't care that it's technically correct, because they want the calculator answer.
I contributed to this re-direction by showing that I could get the DFP to work on a Linux box with the software shown in the wiki article. I think the writer of the article wanted to show that the integer part of the result was inaccurate (most articles on binary floating point imply the inaccuracy is only after the decimal point). So then the accuracy became the new issue!
This topic is more about the future of Perl, then about the accuracy of Perl. Just like the calculator designer(s) realized that rounding was an important element if they wanted to sell calculators, I think Perl needs to do a *better* job meeting the expectations of new users.
Let me be the example:
I was a system programmer for 15 years and then later an application programmer for many more years before ever using Perl. My stumbling block in the beginning was 'use strict;'. Today all my scripts have that statement. But in the beginning, I would get cryptic warnings, and when I commented out 'use strict;', the script ran and gave the correct answer. But I had to get a lot more experience with Perl before I understood the warning messages. Now I fix the warning and have a better script!
My original intent was to discuss Decimal Floating Point(DFP) as a way to give calculator like answers for most beginners. When more experienced they could use the speed of binary floating point, but would need to do the rounding themselves.
I hope I clarified my intended topic.
Regards...Ed
"Well done is better than well said." - Benjamin Franklin
|