RFR: 8343829: Unify decimal and hexadecimal parsing in FloatingDecimal [v9]
Chen Liang
liach at openjdk.org
Fri May 9 23:02:00 UTC 2025
On Fri, 9 May 2025 22:48:34 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:
>> See the JBS bug for some details.
>
> Raffaello Giulietti has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 14 additional commits since the last revision:
>
> - Removed useless comment.
> - Merge branch 'master' into 8343829
> - Added javadoc to refer to the grammar in j.l.Double.
> - Merge branch 'master' into 8343829
> - Make some static arrays @Stable.
> - Remove unused BIG_DECIMAL_EXPONENT
> - Merge branch 'master' into 8343829
> - Merge branch 'master' into 8343829
> - Redacted comments.
> - Merge branch 'master' into 8343829
> - ... and 4 more: https://git.openjdk.org/jdk/compare/e0e999c4...88fe2c08
Took a look over the string parsing part. Not professional enough about floating numbers.
src/java.base/share/classes/jdk/internal/math/FloatingDecimal.java line 1964:
> 1962:
> 1963: /* Skip opt [FfDd]? suffix. */
> 1964: if (i < len && (((ch = in.charAt(i) | 0b10_0000)) == 'f' || ch == 'd')) {
Is it really right to ignore these suffix for all ix values?
src/java.base/share/classes/jdk/internal/math/FloatingDecimal.java line 2006:
> 2004: *
> 2005: * |lz |pt |tnz |stop
> 2006: * 0000000012345600000023.4567000000000
Suggestion:
* |lz |pt |tnz |stop
* 0000000012345600000023.4567000000000
src/java.base/share/classes/jdk/internal/math/FloatingDecimal.java line 2265:
> 2263:
> 2264: /* Arithmetically "appends the digit" ch to v >= 0, clamping at 10^10. */
> 2265: private static long appendDigit(long v, int ch) {
Since this appends only decimal digit, should we name it `appendDecDegit`? In the use site we already note all exponents are decimals.
-------------
PR Review: https://git.openjdk.org/jdk/pull/22737#pullrequestreview-2829815281
PR Review Comment: https://git.openjdk.org/jdk/pull/22737#discussion_r2082593368
PR Review Comment: https://git.openjdk.org/jdk/pull/22737#discussion_r2082588752
PR Review Comment: https://git.openjdk.org/jdk/pull/22737#discussion_r2082592192
More information about the core-libs-dev
mailing list