diff options
| author | Chris Denton <christophersdenton@gmail.com> | 2025-04-12 21:05:30 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-12 21:05:30 +0000 |
| commit | 824ef7fd64f851a66fee925a79fb16980d4b82ba (patch) | |
| tree | 3de24afb7c0f43de1136bbfb3500a543b38e68fe | |
| parent | e0f92bb53c67a2b97ba991a5153cd1f396848d06 (diff) | |
| parent | 072678ec8631797fb2a8c4555e11418ae5e601f6 (diff) | |
| download | rust-824ef7fd64f851a66fee925a79fb16980d4b82ba.tar.gz rust-824ef7fd64f851a66fee925a79fb16980d4b82ba.zip | |
Rollup merge of #139701 - Rudxain:doc-pow2, r=tgross35
docs: clarify uint exponent for `is_power_of_two`
This makes the documentation more explicit for that method. I know this might seem "nit-picky", but `k` could be interpreted as "any Real or Complex number". A trivial example would be $`3 = 2^{log_2(3)}`$ which "proves that three is a power of two" (according to that vague definition).
BTW, when I read the implementation, I was surprised to see that `1` is considered a power of 2 despite being odd (it does make sense in some contexts, but still not intuitive). So I wrote "positive int" before correcting it to "unsigned int"
| -rw-r--r-- | library/core/src/num/uint_macros.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 1b2acdc5a0d..3678bb091e7 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -3343,7 +3343,7 @@ macro_rules! uint_impl { } } - /// Returns `true` if and only if `self == 2^k` for some `k`. + /// Returns `true` if and only if `self == 2^k` for some unsigned integer `k`. /// /// # Examples /// |
