Re: RFR: 8233760: Result of BigDecimal.toString throws overflow exception on new BigDecimal(str) [v2]
On Fri, 27 May 2022 22:59:47 GMT, Raffaello Giulietti 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) Marked as reviewed by darcy (Reviewer). - PR: https://git.openjdk.java.net/jdk/pull/8905
Re: RFR: 8233760: Result of BigDecimal.toString throws overflow exception on new BigDecimal(str) [v2]
On Fri, 27 May 2022 22:59:47 GMT, Raffaello Giulietti 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
Re: RFR: 8233760: Result of BigDecimal.toString throws overflow exception on new BigDecimal(str) [v2]
On Fri, 27 May 2022 20:16:12 GMT, Joe Darcy wrote: >> 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) > > test/jdk/java/math/BigDecimal/StringConstructor.java line 69: > >> 67: constructWithError("0.01e"+Integer.MIN_VALUE); >> 68: constructWithError("1e"+((long)Integer.MIN_VALUE-1)); >> 69: > > Please add some test cases to demonstrate that the round-tripping that > previous did not work is functional after the fix. Tests were added in the new commit. - PR: https://git.openjdk.java.net/jdk/pull/8905
Re: RFR: 8233760: Result of BigDecimal.toString throws overflow exception on new BigDecimal(str) [v2]
> 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) - Changes: - all: https://git.openjdk.java.net/jdk/pull/8905/files - new: https://git.openjdk.java.net/jdk/pull/8905/files/e82cece0..2a25c359 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8905&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8905&range=00-01 Stats: 22 lines in 1 file changed: 21 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/8905.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8905/head:pull/8905 PR: https://git.openjdk.java.net/jdk/pull/8905