On Fri, 27 May 2022 22:59:47 GMT, Raffaello Giulietti <d...@openjdk.java.net> 
wrote:

>> BigDecimal(String) currently fails to accept some strings produced by 
>> BigDecimal.toString(). This PR removes this limitation.
>
> Raffaello Giulietti has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8233760: Result of BigDecimal.toString throws overflow exception on new 
> BigDecimal(str)

Hello,

here's an explanation of the changes in `BigDecimal`.

Rather than keeping track of a local `int scl` (scale) and a local `long exp` 
(exponent), the change only keeps track of a `long scl`, adapting it 
accordingly. It checks the range of `scl` before initializing the fields. This 
makes for a simpler code.

In addition, I couldn't resist changing C-style arrays to Java style over the 
whole class.

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

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

Reply via email to