[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/90759] New: BigDecimal.toPlainString() gives wrong result
From: |
guillerodriguez.dev at gmail dot com |
Subject: |
[Bug classpath/90759] New: BigDecimal.toPlainString() gives wrong result for negative integer values |
Date: |
Wed, 05 Jun 2019 15:13:47 +0000 |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90759
Bug ID: 90759
Summary: BigDecimal.toPlainString() gives wrong result for
negative integer values
Product: classpath
Version: 0.99
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: classpath
Assignee: unassigned at gcc dot gnu.org
Reporter: guillerodriguez.dev at gmail dot com
Target Milestone: ---
BigDecimal.toPlainString() does not work as expected for negative integer
values if the scale is also < 0.
Here's a test case:
bd = new BigDecimal(-10);
bd = bd.stripTrailingZeros();
System.out.println("toString(): " + bd);
System.out.println("toPlainString(): " + bd.toPlainString());
BigDecimal bd = new BigDecimal(new BigInteger("-1", 10), -1);
System.out.println("toString(): " + bd);
System.out.println("toPlainString(): " + bd.toPlainString());
This prints:
toString(): -1.E+1
toPlainString(): -1 // -> should be -10
toString(): -1.E+1
toPlainString(): -1 // -> should be -10
- [Bug classpath/90759] New: BigDecimal.toPlainString() gives wrong result for negative integer values,
guillerodriguez.dev at gmail dot com <=