镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Compare integral numbers without losing precision - #210

Open
PHJ2000 wants to merge 1 commit into
skyscreamer:masterfrom
PHJ2000:fix-exact-integral-comparison
Open

PHJ2000 wants to merge 1 commit into
skyscreamer:masterfrom
PHJ2000:fix-exact-integral-comparison

Conversation

@PHJ2000

@PHJ2000 PHJ2000 commented Nov 6, 2026

Copy link
Copy Markdown

Compare standard integral Number pairs exactly instead of converting both values to double. Distinct long IDs such as 3965376318358833921 and 3965376318358833920 now fail comparison as expected; BigInteger values are compared without truncating them to long.

Keep the protected comparison hook and the existing floating-point, decimal, and mixed-number coercion behavior. This change does not redefine those comparisons or unordered-array matching.

Validation:

  • The same 12 regression tests fail in 5 cases on the current base and all pass with the fix; the other 7 cases pass on both versions.
  • mvn -B -ntp verify: all 166 tests pass on Java 11, with Java 8 release compilation.
  • mvn -B -ntp surefire:test with JAVA_HOME set to Corretto 8: all 166 tests pass on Java 8 (1.8.0_504).

Fixes #203.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comparing long values by comparing doubles

1 participant