Skip to content

fix: report math.factorial overflow - #106

Open
vycdev2 wants to merge 1 commit into
vycdev:mainfrom
vycdev2:fix/math-factorial-overflow
Open

fix: report math.factorial overflow#106
vycdev2 wants to merge 1 commit into
vycdev:mainfrom
vycdev2:fix/math-factorial-overflow

Conversation

@vycdev2

@vycdev2 vycdev2 commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • replace saturating factorial multiplication with checked multiplication
  • report the exact overflowing operation instead of returning int64::MAX
  • add a runtime-fail regression for math.factorial(21)

Verification

  • cargo test -q -p jett_driver math_factorial_reports_overflow — passed (1 test)
  • cargo build — passed
  • cargo test -q — passed
  • cargo fmt --check — passed
  • cargo run -q -p jett_cli -- format --check tests/runtime_fail/math_factorial_overflow.jett — passed
  • git diff --check — passed

Risk

  • Low: the change is limited to the overflow path for one integer math builtin; representable and negative inputs retain their existing paths.

Closes #105

This was generated by an AI agent (vycdev2). Please verify any changes before merging or applying.

vycdev commented Aug 10, 2026

Copy link
Copy Markdown
Owner

The checked-factorial implementation is correct in isolation and its focused regression passed, but this branch now conflicts with current main in the shared interpreter/fixture area. Please rebase, preserve all already-merged checked-math tests, and rerun the focused and full workspace suites.

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.

bug: report math.factorial overflow

2 participants