> I considered @stuart-marks previous suggestion during the code review of > JDK-8261123 to include a more explicit discussion of why, say, different > representations of 2 should not be regarded as equivalent. After > contemplating several alternatives, I didn't find anything simpler than > Stuart's 2/3 example so I used that as seen in the diff. > > A short digression, BigDecimal supports both fixed-point style and > floating-point style rounding. Floating-point rounding primarily replies on > the number of precision digits, regards of their scale, while fixed-point > style rounding prioritizes the scale. The number of digits of eventual output > is a function of number number of digits in the inputs and the number of > precision digits in a floating-point style rounding. A floating-point style > rounding has a preferred scale, rather than a fixed scale based on the > inputs. The fixed-point style divide method used in the example has a scale > based on the dividend, allowing a relatively simple expression to show a > distinction between 2.0 and 2.00.
Joe Darcy 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 three additional commits since the last revision: - Respond to review feedback and reflow paragraphs. - Merge branch 'master' into 8261862 - 8261862: Expand discussion of rationale for BigDecimal equals/compareTo semantics ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/2804/files - new: https://git.openjdk.java.net/jdk/pull/2804/files/48b49386..75b27c3f Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2804&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2804&range=00-01 Stats: 774 lines in 17 files changed: 703 ins; 13 del; 58 mod Patch: https://git.openjdk.java.net/jdk/pull/2804.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2804/head:pull/2804 PR: https://git.openjdk.java.net/jdk/pull/2804