|
From: | guillerodriguez.dev at gmail dot com |
Subject: | [Bug classpath/90759] BigDecimal.toPlainString() gives wrong result for negative integer values |
Date: | Wed, 05 Jun 2019 15:15:48 +0000 |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90759 --- Comment #1 from Guillermo Rodriguez <guillerodriguez.dev at gmail dot com> --- Here's a fix for this bug: public String toPlainString() { [...] else { // We must append zeros instead of using scientific notation. sb.append(bigStr); + int ndigits = bigStr.length() - (negative ? 1 : 0); + for (int i = ndigits; i < point; i++) - for (int i = bigStr.length(); i < point; i++) sb.append('0'); } return sb.toString(); }
[Prev in Thread] | Current Thread | [Next in Thread] |