Repository navigation
Use plain notation for short multipleOf divisors in error messages - #1329
Conversation
|
Thanks for the PR. A few findings from review. Tests pass locally (159 on JDK 17).
The same points apply to #1330. |
|
Thanks for the update. I re-reviewed ac95748. Fixed: point 3. Still open (the main code hasn't changed):
Please address these or reply on whether you plan to. If you disagree with any of them, a short note is fine. |
|
Thanks for the re-review. Points 1, 2, and 4 are now addressed:
The literal, multi-digit boundary tests for point 3 remain in place. Javadoc and CHANGELOG now describe the final behavior. All 180 MultipleOfValidatorTest cases pass on JDK 17. |
|
Thanks for this. The new formatting looks correct. I fuzzed the plain-length formula in 1. Avoid converting to a string twice when When the plain length is over 32 and String text = value.toString();
if (length > text.length()) {
return text;
}
return text.indexOf('E') < 0 ? text : value.toPlainString();2. Simplify The The same two points apply to #1330. |
|
Thanks for checking the formatting so thoroughly. Both suggestions are now addressed:
All 179 MultipleOfValidatorTest cases and the full suite pass on JDK 17. |
stevehu
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround. I re-reviewed a218037: both suggestions are in. The plain-notation reuse avoids the second conversion without changing output, and inheritedDivisorUsesPlainNotation now tests only the delegating override. MultipleOfValidatorTest passes locally (179 tests on JDK 21) and CI is green.
I'll follow up separately with two small master-only consistency fixes, so no changes needed here:
- document in the
getDivisor/getDividendJavadoc that non-finite nodes return null (as #1330 now does on 2.x); - port the failing-override case of
convertedNonFiniteInputDoesNotRoundTheDivisorfrom #1330.
Approving and merging.
Document that getDivisor and getDividend return null for non-finite floating-point nodes, and add the failing-override case to convertedNonFiniteInputDoesNotRoundTheDivisor. Follow-up to #1329. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Refs #1328. Corresponding 2.x PR: #1330.
Display
multipleOfdivisors in plain notation when the result fits within 32 characters or is no longer thanBigDecimal.toString(). Otherwise, retain that representation without truncation or rounding. Check the length before expansion to avoid excessive padding for extreme scales.Apply the same formatting to custom
getDivisor()results, preserving trailing zeros such as3.0and100.00. Ignore zero divisors returned by overrides, regardless of scale, matching the default conversion.Update Javadoc and CHANGELOG, and add regression coverage for multi-digit formatting boundaries, large integers ending in zero, custom conversions, and zero divisors across ordinary and extreme scales.
Validation:
mvn -B -Dtest=MultipleOfValidatorTest teston JDK 17 — 179 tests passed.