-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
f*::min/max: fix comparing with libm and IEEE operations #149563
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
Conversation
|
|
library/core/src/intrinsics/mod.rs
Outdated
| /// Returns the minimum of two `f16` values, ignoring NaN. | ||
| /// | ||
| /// This behaves like IEEE 754-2008 minNum. In particular: | ||
| /// If one of the arguments is NaN, then the other argument is returned. If the inputs compare equal | ||
| /// If one of the arguments is NaN (quiet or signaling), then the other argument is returned. If the inputs compare equal | ||
| /// (such as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically. |
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.
Is it worth also mentioning the (NaN,NaN) case? Similar to #149477
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.
Like this?
…r=mati865 interpret: test SNaN handling of float min/max and update comments Also see rust-lang#149563. I also renamed these enum variants so they are not almost identical.
|
@bors r+ rollup |
interpret: test SNaN handling of float min/max and update comments Also see rust-lang/rust#149563. I also renamed these enum variants so they are not almost identical.
Rollup of 4 pull requests Successful merges: - #149563 (f*::min/max: fix comparing with libm and IEEE operations) - #149592 (`is_const_default_method` is completely handled by the `constness` query) - #149662 (Move attribute lints to `rustc_lint`) - #149684 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #149563 - RalfJung:f-min-max, r=tgross35 f*::min/max: fix comparing with libm and IEEE operations What we document actually doesn't match what libm does any more, libm got "fixed"/changed in https://sourceware.org/bugzilla/show_bug.cgi?id=20947. So better remove the remark. Instead, explicitly call out that this is a mix of `minNum` and `minimumNumber`. Also fix the intrinsics which incorrectly claimed to be like `minNum`, but their intended SNaN behavior is actually different from that. r? `@tgross35`
Rollup of 4 pull requests Successful merges: - rust-lang/rust#149563 (f*::min/max: fix comparing with libm and IEEE operations) - rust-lang/rust#149592 (`is_const_default_method` is completely handled by the `constness` query) - rust-lang/rust#149662 (Move attribute lints to `rustc_lint`) - rust-lang/rust#149684 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
What we document actually doesn't match what libm does any more, libm got "fixed"/changed in https://sourceware.org/bugzilla/show_bug.cgi?id=20947. So better remove the remark. Instead, explicitly call out that this is a mix of
minNumandminimumNumber.Also fix the intrinsics which incorrectly claimed to be like
minNum, but their intended SNaN behavior is actually different from that.r? @tgross35