Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 73857 invoked from network); 12 Jun 2010 17:55:05 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Jun 2010 17:55:05 -0000 Received: (qmail 12719 invoked by uid 500); 12 Jun 2010 17:55:04 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 12642 invoked by uid 500); 12 Jun 2010 17:55:03 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 12633 invoked by uid 99); 12 Jun 2010 17:55:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Jun 2010 17:55:03 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [147.210.36.3] (HELO drimmsvc1.drimm.u-bordeaux1.fr) (147.210.36.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Jun 2010 17:54:54 +0000 Received: from drimmsvc1.drimm.u-bordeaux1.fr (drimmsvc2.drimm.u-bordeaux1.fr [147.210.36.4]) by drimmsvc1.drimm.u-bordeaux1.fr (Postfix) with ESMTP id 8C34337A0051 for ; Sat, 12 Jun 2010 19:54:31 +0200 (CEST) Received: from horde.drimm.u-bordeaux1.fr (fela.drimm.u-bordeaux1.fr [147.210.36.137]) by drimmsvc1.drimm.u-bordeaux1.fr (Postfix) with ESMTP id 77A1E37A004E for ; Sat, 12 Jun 2010 19:54:31 +0200 (CEST) Received: from lns-bzn-27-82-248-40-116.adsl.proxad.net (lns-bzn-27-82-248-40-116.adsl.proxad.net [82.248.40.116]) by horde.u-bordeaux1.fr (Horde Framework) with HTTP; Sat, 12 Jun 2010 19:54:31 +0200 Message-ID: <20100612195431.18783jwtrf1pma53@horde.u-bordeaux1.fr> Date: Sat, 12 Jun 2010 19:54:31 +0200 From: Pons Rudy To: dev@harmony.apache.org Subject: [classlib][luni] Formatter: BigDecimal differences from RI MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.3.5) X-AV-Checked: ClamAV Hello, I'm working on rounding errors when using DecimalFormat, and have seen a difference from RI. I think this is a RI bug: When using, for example, System.out.printf("%.6f", new BigDecimal("0.12345678"));, no rounding will be performed, and 0.12345678 will be displayed on RI. However, on Harmony, 0.123457 will be print. I see no reason for not rounding when using BigDecimal, so I think we should keep this behaviour. Current unit tests only use integral BigDecimal, so I will add tests after answer to my question. I have another problem with BigDecimal : BigDecimal does not seem to keep trace of negative or positive zero. So System.out.printf("%f", new BigDecimal("-0.0")); will print 0.0, both on RI and Harmony. But, if we round BigDecimal in printf, do you think the result of System.out.printf("%.6f", "-0.00000012345"); should be 0.000000 or -0.000000 ?