RFR: 8233760: Result of BigDecimal.toString throws overflow exception on new BigDecimal(str)

Raffaello Giulietti duke at openjdk.java.net
Thu May 26 18:10:11 UTC 2022


On Thu, 26 May 2022 18:02:14 GMT, Raffaello Giulietti <duke at openjdk.java.net> wrote:

> BigDecimal(String) currently fails to accept some strings produced by BigDecimal.toString(). This PR removes this limitation.

This happens because the constructor currently only accepts exponents in the `int` range (more precisely, in the open range (-2^31, 2^31)).
It should accept a larger range of exponents, as long as the resulting `BigDecimal` has a scale in the `int` range.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8905


More information about the core-libs-dev mailing list