Skip to content

Preserve precision when comparing numbers of the same type - #1192

Open
PHJ2000 wants to merge 1 commit into
jknack:masterfrom
PHJ2000:fix-exact-numeric-equality
Open

PHJ2000 wants to merge 1 commit into
jknack:masterfrom
PHJ2000:fix-exact-numeric-equality

Conversation

@PHJ2000

@PHJ2000 PHJ2000 commented Oct 5, 2026

Copy link
Copy Markdown

Use the existing comparison method for same-class, comparable numbers before falling back to double. This keeps distinct Long, BigInteger, and BigDecimal values distinct in eq/neq.

Keeps the existing mixed-type fallback and floating-point equality behavior, including signed zero. Tests cover template output, big numbers, decimal scale, and those compatibility cases.

Validation: mvn -pl handlebars -am verify — 1,041 tests, no failures, 3 skipped (JDK 21). Changed Java files formatted with Spotless.

Fixes #1191.

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.

eq treats distinct large Long values as equal

1 participant