Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trait for wrapping_div and wrapping_rem #238

Open
lukyxu opened this issue May 19, 2022 · 1 comment
Open

Add trait for wrapping_div and wrapping_rem #238

lukyxu opened this issue May 19, 2022 · 1 comment

Comments

@lukyxu
Copy link

lukyxu commented May 19, 2022

There exist traits for wrapping_add, wrapping_sub, wrapping_mul, wrapping_shl, wrapping_shr and wrapping_neg. Is there a reason why there isn't a trait for wrapping div and wrapping rem?

@cuviper
Copy link
Member

cuviper commented May 20, 2022

No particular reason, just that nobody has wanted them yet.

I'm not sure it's very useful to have these in generic contexts -- the only input that actually wraps is signed MIN / -1. Division by zero still panics, at least. But if you have a use case, I wouldn't mind a pull request for new traits.

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

No branches or pull requests

2 participants