Date: | Sun, 28 Dec 2003 14:15:57 +0300 |
From: | Michael Korneenkov <mk [...] datapro.ru> |
To: | bug-wddx [...] rt.cpan.org |
Subject: | bug in WDDX::Number v1.01 |
The module incorrect trims numbers...
Example code:
==============================================================================================
use WDDX;
my $d = "0.0678906789067890678906789";
test($d);
my $d = 0.0678906789067890678906789;
test($d);
my $d = "0.1234512345123451234512345";
test($d);
my $d = 0.123451234512345123451234512345;
test($d);
print "\n";
####################
sub test {
$d = shift;
print "\n\n$d";
$w = new WDDX;
my $t1 = $w->serialize($w->number( $d )) ;
print "\n$t1";
}
==============================================================================================
Output is:
==============================================================================================
Floating point number exceeds supported accuracy; trimming to 15 digits.
Floating point number exceeds supported accuracy; trimming to 15 digits.
0.0678906789067890678906789
<wddxPacket version='1.0'><header/><data><number>91</number></data></wddxPacket>
0.0678906789067891
<wddxPacket version='1.0'><header/><data><number>91</number></data></wddxPacket>
0.1234512345123451234512345
<wddxPacket version='1.0'><header/><data><number>0.123451234512345</number></data></wddxPacket>
0.123451234512345
<wddxPacket version='1.0'><header/><data><number>0.123451234512345</number></data></wddxPacket>
==============================================================================================