RFR: JDK-8295391: Add discussion of binary <-> decimal conversion issues

Brian Burkhalter bpb at openjdk.org
Wed Nov 8 17:59:02 UTC 2023


On Wed, 8 Nov 2023 17:29:28 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> Add discussion of some of the common pitfalls related to decimal <-> binary conversion.

src/java.base/share/classes/java/lang/Double.java line 212:

> 210:  * fraction (0.33333....); but in base 3, 1/3 is exactly
> 211:  * 0.1<sub>(3)</sub>, that is 1 × 3<sup>-1</sup>.
> 212:  * Similarly, in base 10, 1/10 is exactly presentable as 0.1, but in

`re`presentable?

src/java.base/share/classes/java/lang/Double.java line 234:

> 232:  * consistent with a {@code float} value having the equivalent of 6 to
> 233:  * 9 digits of decimal precision and a {@code double} value having the
> 234:  * equivalent of 15 and 17 digits of decimal precision. (The

15 `to` 17?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16566#discussion_r1387005350
PR Review Comment: https://git.openjdk.org/jdk/pull/16566#discussion_r1387006602


More information about the core-libs-dev mailing list