Skip to content

Fix String.toInt near maximum safe integer - #135

Merged
robinheghan merged 1 commit into
gren-lang:mainfrom
shin4141:codex/fix-string-to-int-precision
Aug 14, 2026
Merged

Fix String.toInt near maximum safe integer#135
robinheghan merged 1 commit into
gren-lang:mainfrom
shin4141:codex/fix-string-to-int-precision

Conversation

@shin4141

Copy link
Copy Markdown
Contributor

Summary

  • normalize each digit before adding it to the running total, avoiding a transient value above JavaScript's maximum safe integer
  • add regressions for the last unaffected boundary, the first affected odd value, and the positive and negative maximum safe integers

Verification

  • unit suite: 741 passed, 0 failed
  • integration suite: 1022 passed, 0 failed
  • git diff --check

Closes #134.

@robinheghan
robinheghan merged commit ee36bbf into gren-lang:main Aug 14, 2026
1 check passed
@robinheghan

Copy link
Copy Markdown
Member

Thank you!

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.

String.toInt returns the wrong value for 24 exactly-representable integers near 2^53

2 participants