-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
more float constants #151825
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
more float constants #151825
Conversation
This comment has been minimized.
This comment has been minimized.
|
Not sure why this failed, #93784 seems to be relevant. |
efa31c1 to
403ff9b
Compare
This comment has been minimized.
This comment has been minimized.
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.
Two small nits then LGTM
| /// sqrt(5) | ||
| #[unstable(feature = "f128", issue = "116909")] | ||
| // Also, #[unstable(feature = "more_float_constants", issue = "146939")] | ||
| pub const SQRT_5: f128 = 2.23606797749978969640917366873127623544061835961152572427089_f128; | ||
|
|
||
| /// 1/sqrt(5) | ||
| #[unstable(feature = "f128", issue = "116909")] | ||
| // Also, #[unstable(feature = "more_float_constants", issue = "146939")] | ||
| pub const FRAC_1_SQRT_5: f128 = | ||
| 0.447213595499957939281834733746255247088123671922305144854179_f128; |
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.
For f16 and f128, gate these under more_float_constants and leave the f128 gate in a comment. Bit safer since stabilizing this feature without f16/f128 would still not let you use these, but not the other way around.
library/core/src/num/f16.rs
Outdated
| /// sqrt(5) | ||
| #[unstable(feature = "f16", issue = "116909")] | ||
| // Also, #[unstable(feature = "more_float_constants", issue = "146939")] | ||
| pub const SQRT_5: f16 = 2.236067977499789696409173668731276235_f16; |
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.
Extremely minor nit: the SQRT_5 value is correct, but it has 37 significant digits while we use 36 significant digits for f16/f32/f64. Mind chopping one off?
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.
(updating status)
|
Reminder, once the PR becomes ready for a review, use |
403ff9b to
caaee92
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
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=tgross35 more float constants Add constants discussed in rust-lang#146939 rust-lang/libs-team#661 Retry of rust-lang#146934 r? @tgross35
… r=tgross35 more float constants Add constants discussed in rust-lang#146939 rust-lang/libs-team#661 Retry of rust-lang#146934 r? @tgross35
… r=tgross35 more float constants Add constants discussed in rust-lang#146939 rust-lang/libs-team#661 Retry of rust-lang#146934 r? @tgross35
…uwer Rollup of 11 pull requests Successful merges: - #150992 (link modifier `export-symbols`: export all global symbols from selected uptream c static libraries) - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive) - #151938 (Use `#![feature(adt_const_params)]` for static query flags) - #151172 (Use default field values in a few more cases) - #151825 (more float constants) - #151870 (regression test for alias-relate changes in lub) - #151902 (explain why we dont skip some of this work when there are field projections) - #151974 (Update documentation for `Result::ok()`) - #151978 (Query cleanups) - #151979 (Fix uninitialized UEFI globals in tests) - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
… r=tgross35 more float constants Add constants discussed in rust-lang#146939 rust-lang/libs-team#661 Retry of rust-lang#146934 r? @tgross35
…uwer Rollup of 12 pull requests Successful merges: - #149596 (resolve: Report more visibility-related early resolution ambiguities for imports) - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive) - #151938 (Use `#![feature(adt_const_params)]` for static query flags) - #151172 (Use default field values in a few more cases) - #151825 (more float constants) - #151870 (regression test for alias-relate changes in lub) - #151872 (Add inline syntax for diagnostic messages) - #151902 (explain why we dont skip some of this work when there are field projections) - #151909 (Skip overlapping spans in argument error suggestions) - #151978 (Query cleanups) - #151979 (Fix uninitialized UEFI globals in tests) - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
…uwer Rollup of 12 pull requests Successful merges: - #149596 (resolve: Report more visibility-related early resolution ambiguities for imports) - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive) - #151938 (Use `#![feature(adt_const_params)]` for static query flags) - #151172 (Use default field values in a few more cases) - #151825 (more float constants) - #151870 (regression test for alias-relate changes in lub) - #151872 (Add inline syntax for diagnostic messages) - #151902 (explain why we dont skip some of this work when there are field projections) - #151909 (Skip overlapping spans in argument error suggestions) - #151978 (Query cleanups) - #151979 (Fix uninitialized UEFI globals in tests) - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
…uwer Rollup of 12 pull requests Successful merges: - #149596 (resolve: Report more visibility-related early resolution ambiguities for imports) - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive) - #151938 (Use `#![feature(adt_const_params)]` for static query flags) - #151172 (Use default field values in a few more cases) - #151825 (more float constants) - #151870 (regression test for alias-relate changes in lub) - #151872 (Add inline syntax for diagnostic messages) - #151902 (explain why we dont skip some of this work when there are field projections) - #151909 (Skip overlapping spans in argument error suggestions) - #151978 (Query cleanups) - #151979 (Fix uninitialized UEFI globals in tests) - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
Rollup merge of #151825 - joshuarayton:more-float-constants, r=tgross35 more float constants Add constants discussed in #146939 rust-lang/libs-team#661 Retry of #146934 r? @tgross35
Add constants discussed in #146939 rust-lang/libs-team#661
Retry of #146934
r? @tgross35