rust-num / num-integer

Integer trait and functions for Rust
Apache License 2.0
180 stars 48 forks source link

Fix is_multiple_of to account for 0 #47

Closed WizardOfMenlo closed 2 years ago

WizardOfMenlo commented 2 years ago

This pull request fixes the implementation to is_multiple_of to account for the case in which one of the operand is zero. The current implementation panics, while this one currently concludes that 0 is a multiple of 0 (and in fact the only one).

The change is a minimal check, and an inclusion of this edge case in the tests.

cuviper commented 2 years ago

Thanks!

bors r+

bors[bot] commented 2 years ago

Build succeeded: