Skip to content

docs: clarify uint exponent for is_power_of_two #139701

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 13, 2025
Merged

Conversation

Rudxain
Copy link
Contributor

@Rudxain Rudxain commented Apr 12, 2025

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"

@rustbot
Copy link
Collaborator

rustbot commented Apr 12, 2025

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 12, 2025
@tgross35
Copy link
Contributor

Fair enough, thanks for adding the clarification.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 12, 2025

📌 Commit 072678e has been approved by tgross35

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 12, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 13, 2025
…enton

Rollup of 8 pull requests

Successful merges:

 - rust-lang#139163 (indirect-const-stabilize the `exact_div` intrinsic)
 - rust-lang#139276 (Revert "Disable `f16` on Aarch64 without `neon`")
 - rust-lang#139315 (Switch `time` to `jiff` for time formatting in ICE dumps)
 - rust-lang#139382 (Update windows-bindgen to 0.61.0)
 - rust-lang#139688 (rustdoc-search: add unbox flag to Result aliases)
 - rust-lang#139701 (docs: clarify uint exponent for `is_power_of_two`)
 - rust-lang#139705 (Removed outdated ui test suite README, give reasons for disabled tests)
 - rust-lang#139713 (Fix typo in documentation)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 13, 2025
…enton

Rollup of 8 pull requests

Successful merges:

 - rust-lang#139163 (indirect-const-stabilize the `exact_div` intrinsic)
 - rust-lang#139276 (Revert "Disable `f16` on Aarch64 without `neon`")
 - rust-lang#139315 (Switch `time` to `jiff` for time formatting in ICE dumps)
 - rust-lang#139382 (Update windows-bindgen to 0.61.0)
 - rust-lang#139688 (rustdoc-search: add unbox flag to Result aliases)
 - rust-lang#139701 (docs: clarify uint exponent for `is_power_of_two`)
 - rust-lang#139705 (Removed outdated ui test suite README, give reasons for disabled tests)
 - rust-lang#139713 (Fix typo in documentation)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 824ef7f into rust-lang:master Apr 13, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 13, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 13, 2025
Rollup merge of rust-lang#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"
@Rudxain Rudxain deleted the doc-pow2 branch April 13, 2025 07:53
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Apr 19, 2025
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"
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants