Should `INT_MIN % -1` return 0 instead of panicking?
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
As @bill-myers originally pointed out here INT_MIN % -1 is mathematically well-defined to be 0, but Rust currently unconditionally panics instead, as like INT_MIN / -1 it is technically an overflow according to the two's complement representation. If we're incurring a branch to test for this case anyways, then we might as well return the correct result.
("Forked" from #1237.)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked RFC #146 discussion and the forked issue #1237 to understand the existing decision and rationale. The work is done when the project has a settled specification for whether INT_MIN % -1 returns 0 or panics, including the overflow semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100