isaacholt100 / bnum

Arbitrary, fixed size numeric types that extend the functionality of primitive numeric types in Rust.
https://crates.io/crates/bnum
Other
67 stars 8 forks source link

ilog behaves differently from std lib #39

Closed chipshort closed 4 months ago

chipshort commented 4 months ago

The unchecked ilog* functions in the std crate always panic for inputs <= 0, even in release mode (see also this playground), while the implementation in here only panics in debug mode and returns 0 in release mode.

If this is unintended, I'd be happy to open a PR to behave like the Rust primitives.

isaacholt100 commented 4 months ago

Hi @chipshort, thanks for spotting this and opening the issue! I have now fixed this, and additionally I have made the panic message match that of Rust's primitives. I think I originally wrote these functions when the primitive ilog* methods were unstable, so their behaviour must have changed since then. I've pushed these changes to the latest branch, will merge with master and publish to v0.11.0 soon.

chipshort commented 4 months ago

Thanks for the quick fix!

isaacholt100 commented 4 months ago

@chipshort I've just published v0.11.0, sorry this took a bit of time to actually get done, it's very busy last few weeks!

chipshort commented 4 months ago

No need to appologize. Thanks for creating and maintaining this library!