Skip to content

Preserve large floating-point values when converting to BigInteger - #789

Merged
chhsiao90 merged 1 commit into
modelmapper:masterfrom
PHJ2000:fix-floating-point-biginteger-conversion
Oct 7, 2026
Merged

chhsiao90 merged 1 commit into
modelmapper:masterfrom
PHJ2000:fix-floating-point-biginteger-conversion

Conversation

@PHJ2000

@PHJ2000 PHJ2000 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Convert Float and Double through an exact BigDecimal before truncating to BigInteger. This avoids narrowing through long and preserves truncation toward zero. Tests cover both long bounds, exact powers of two and fractional values.

Fixes #788.

Validation: Java 21 mvn -pl core -am verify passed; both new regression methods passed. Extensions were not run.

@chhsiao90
chhsiao90 merged commit b492e3d into modelmapper:master Oct 7, 2026
5 checks passed
@chhsiao90

Copy link
Copy Markdown
Member

Thanks!

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.

Floating-point to BigInteger conversion saturates at the long bounds

2 participants