Subject: | Floating point precision does not seem to work correctly |
Floating point precision up to 3 or more decimal places does not seem to
work in Number-Format versions 1.60 or higher.
Please run the following sample script in 1.60 or 1.72:
!/usr/bin/perl
use Number::Format;
my $usd2 = new Number::Format(-thousands_sep => ',',
-decimal_point => '.',
-decimal_digits => 2,
-decimal_fill => 1,
-int_curr_symbol => '$');
my $usd3 = new Number::Format(-thousands_sep => ',',
-decimal_point => '.',
-decimal_digits => 3,
-decimal_fill => 1,
-int_curr_symbol => '$');
my $usd4 = new Number::Format(-thousands_sep => ',',
-decimal_point => '.',
-decimal_digits => 4,
-decimal_fill => 1,
-int_curr_symbol => '$');
my $price = 145.12345;
my $show_price = $usd2->format_price($price);
print "$show_price \n";
my $show_price = $usd3->format_price($price);
print "$show_price \n";
my $show_price = $usd4->format_price($price);
print "$show_price \n";
-The above script works in 1.52. This was required in one of our
business applications.