-
Notifications
You must be signed in to change notification settings - Fork 13.3k
fix MAX_EXP and MIN_EXP docs #140150
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
fix MAX_EXP and MIN_EXP docs #140150
Conversation
Maybe it's worth adding something like "... for a significand bounded by 1 <= x < 2 (the IEEE definition), or the maximum power of 2 for a significand bounded by 0.5 <= x < 1 (the C definition)."? To make it sound a bit less like we just picked the wrong number... which maybe we did 🙃 |
library/core/src/num/f128.rs
Outdated
@@ -200,7 +200,7 @@ impl f128 { | |||
/// ≥ 0.5 × 2<sup><i>x</i></sup>. | |||
#[unstable(feature = "f128", issue = "116909")] | |||
pub const MIN_EXP: i32 = -16_381; | |||
/// Maximum possible power of 2 exponent. | |||
/// One greater than the maximum possible power of 2 exponent. | |||
/// | |||
/// If <i>x</i> = `MAX_EXP`, then normal numbers | |||
/// < 1 × 2<sup><i>x</i></sup>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we even have this sentence about normal numbers here? Unlike for MIN_EXP
, normal numbers are not mentioned in the definition of this constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it looks like this here actually uses the C definition of "exponent"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow that is HTML is impossible to read, we should add the rustdoc katex/temml plugin or something. Yeah that mention of normals is probably copy+paste.
I guess we could just add a note that the 0.5 <= x < 1
isn't necessarially the definition that one would expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could just add a note that the 0.5 <= x < 1 isn't necessarially the definition that one would expect.
We now just spell out both definitions, not sure what else there would be to add here? If you want the wording to be changed/extended, please make a concrete suggestion.
I have updated the docs for f128, please have a look before I copy-paste this to all the other types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me but I think there should be an extra line break after "(i.e. the IEEE definition)." to keep the summary down to one sentence.
Like so? |
Thanks, I just know rustdoc and RLA start to look weird when summaries are longer than 1-2 lines in source. @bors r+ rollup |
fix MAX_EXP and MIN_EXP docs As pointed out in rust-lang#88734, the docs for these constants are wrong. r? `@tgross35`
Rollup of 23 pull requests Successful merges: - rust-lang#139261 (mitigate MSVC alignment issue on x86-32) - rust-lang#139307 (std: Add performance warnings to HashMap::get_disjoint_mut) - rust-lang#139700 (Autodiff flags) - rust-lang#139752 (set subsections_via_symbols for ld64 helper sections) - rust-lang#139809 (Don't warn about `v128` in wasm ABI transition) - rust-lang#139852 (StableMIR: Implement `CompilerInterface`) - rust-lang#139945 (Extend HIR to track the source and syntax of a lifetime) - rust-lang#140028 (`deref_patterns`: support string and byte string literals in explicit `deref!("...")` patterns) - rust-lang#140139 (rustc_target: Adjust RISC-V feature implication) - rust-lang#140143 (Move `sys::pal::os::Env` into `sys::env`) - rust-lang#140148 (CI: use aws codebuild for job dist-arm-linux) - rust-lang#140150 (fix MAX_EXP and MIN_EXP docs) - rust-lang#140172 (Make algebraic functions into `const fn` items.) - rust-lang#140177 ([compiletest] Parallelize test discovery) - rust-lang#140181 (Remove `synstructure::Structure::underscore_const` calls.) - rust-lang#140184 (Update doc of cygwin target) - rust-lang#140186 (Rename `compute_x` methods) - rust-lang#140187 ([AIX] Handle AIX dynamic library extensions within c-link-to-rust-dylib run-make test) - rust-lang#140191 (Remove git repository from git config) - rust-lang#140194 (minicore: Have `//@ add-core-stubs` also imply `-Cforce-unwind-tables=yes`) - rust-lang#140195 (triagebot: label minicore changes w/ `A-test-infra-minicore` and ping jieyouxu on changes) - rust-lang#140202 (Make #![feature(let_chains)] bootstrap conditional in compiler/) - rust-lang#140214 (Remove comment about handling non-global where bounds with corresponding projection) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#136083 (Suggest {to,from}_ne_bytes for transmutations between arrays and integers, etc) - rust-lang#138282 (Add `#[repr(u128)]`/`#[repr(i128)]` enums to `improper_ctypes_definitions`) - rust-lang#139700 (Autodiff flags) - rust-lang#140139 (rustc_target: Adjust RISC-V feature implication) - rust-lang#140141 (Move zkVM constants into `sys::env_consts`) - rust-lang#140150 (fix MAX_EXP and MIN_EXP docs) - rust-lang#140172 (Make algebraic functions into `const fn` items.) - rust-lang#140191 (Remove git repository from git config) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#140150 - RalfJung:MAX_EXP, r=tgross35 fix MAX_EXP and MIN_EXP docs As pointed out in rust-lang#88734, the docs for these constants are wrong. r? ``@tgross35``
As pointed out in #88734, the docs for these constants are wrong.
r? @tgross35