{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreigiq7wm4apcpvvgrfrgac4qrajky4ahm4jjiyreczm4yzipoblpla",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mnvroqvyyrg2"
},
"path": "/t/why-is-strict-div-implemented-in-terms-of-overflowing-div-for-signed-integers/24387#post_2",
"publishedAt": "2026-06-10T02:01:01.000Z",
"site": "https://internals.rust-lang.org",
"tags": [
"github.com/rust-lang/rust",
"Implement strict integer operations that panic on overflow (#116090)",
"rmehri01",
"+996\n-15",
"…"
],
"textContent": "Your question doesn't seem to be answered here:\n\ngithub.com/rust-lang/rust\n\n#### Implement strict integer operations that panic on overflow (#116090)\n\n`master` ← `rmehri01:strict_integer_ops`\n\nopened 04:50AM - 23 Sep 23 UTC\n\n\n\n rmehri01\n \n\n\n+996\n-15\n\n\nThis PR implements the first part of the ACP for adding panic on overflow style …arithmetic operations (https://github.com/rust-lang/libs-team/issues/270), mentioned in #116064. It adds the following operations on both signed and unsigned integers: - `strict_add` - `strict_sub` - `strict_mul` - `strict_div` - `strict_div_euclid` - `strict_rem` - `strict_rem_euclid` - `strict_neg` - `strict_shl` - `strict_shr` - `strict_pow` Additionally, signed integers have: - `strict_add_unsigned` - `strict_sub_unsigned` - `strict_abs` And unsigned integers have: - `strict_add_signed` The `div` and `rem` operations are the same as normal division and remainder but are added for completeness similar to the corresponding `wrapping_*` operations. I'm not sure if I missed any operations, I basically found them from the `wrapping_*` and `checked_*` operations on both integer types.\n\nAnd I can't think of a good reason.",
"title": "Why is strict_div implemented in terms of overflowing_div for signed integers?"
}