Date: | Sat, 27 Dec 2003 07:40:26 -0600 |
From: | andy [...] petdance.com |
To: | bug-wddx [...] rt.cpan.org |
Subject: | Fwd: [a bug in WDDX::Number v1.01: mk@datapro.ru] |
Return-Path: <mk@datapro.ru>
X-Original-To: andy@petdance.com
Delivered-To: andy@petdance.com
Received: from frontend2.aha.ru (virtmail2.aha.ru [195.2.83.174])
by baby.petdance.com (Postfix) with ESMTP id 2B1F443DDE
for <andy@petdance.com>; Sat, 27 Dec 2003 07:36:55 -0600 (CST)
Received: from ppp96-199.dialup.mtu-net.ru (account misha@datapro.ru [212.188.96.199] verified)
by frontend2.aha.ru (CommuniGate Pro SMTP 4.1.8)
with ESMTP id 243009679 for andy@petdance.com; Sat, 27 Dec 2003 16:36:52 +0300
Date: Sat, 27 Dec 2003 16:43:55 +0300
From: Michael Korneenkov <mk@datapro.ru>
X-Mailer: The Bat! (v1.53d) Personal
Reply-To: Michael Korneenkov <mk@datapro.ru>
Organization: DataPro
X-Priority: 3 (Normal)
Message-ID: <1871190123.20031227164355@datapro.ru>
To: andy@petdance.com
Subject: a bug in WDDX::Number v1.01
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello andy,
i found a bug in WDDX::Number v1.01
when i tried to packet a number which has more point numbers than 15, it
save wrong number
THE CODE WAS
if ( $value =~ /^(\+|-)?(\d*)(\.\d+)?(?:E(\+|-)?(\d+))?$/i
and length $3 > 16 ) {
warn "Floating point number exceeds supported accuracy; " .
"trimming to 15 digits.\n";
$value = ( "$1$2" . substr( $3, 15 ) . "$4$5" ) + 0;
}
I CHANGE IT TO:
if ( $value =~ /^(\+|-)?(\d*)(\.\d+)?(?:E(\+|-)?(\d+))?$/i
and length $3 > 16 ) {
warn "Floating point number exceeds supported accuracy; " .
"trimming to 15 digits.\n";
my ($fractal) = $3 =~ /^(.{16})/;
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
$value = ( "$1$2" . $fractal . "$4$5" ) + 0;
# ^^^^^^^^
}
--
Best regards,
Michael mailto:mk@datapro.ru