-
Notifications
You must be signed in to change notification settings - Fork 49
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
Contribute is_power_of_ten? #14
Comments
I'm open to it, if we can present it in a generic trait befitting the rest of the crate. That doesn't mean that you have to have a generic implementation, just that it's designed such that things like The unsigned primitive integers already have pub trait Power2: Integer {
fn is_power_of_two(&self) -> bool;
fn next_power_of_two(&self) -> Self;
}
pub trait Power10: Integer {
fn is_power_of_ten(&self) -> bool;
fn next_power_of_ten(&self) -> Self;
} Or maybe just combine those into a single Could we reasonably implement checks for arbitrary powers of |
Floored |
A separate trait is consistent with the way I was thinking about it. Curious, why don't signed primitive integers implement How would we abstract over arbitrary powers on |
I'm not sure, but probably just because negative inputs are useless if they're all Similarly, what would
Yeah, |
Alright, that gives me enough to move this over to a PR. Expect something in the next few days. 😄 |
I'd like to contribute a high performance implementation of is_power_of_ten. Is that an appropriate function for this crate?
The text was updated successfully, but these errors were encountered: