Skip to content

Conversation

@RalfJung
Copy link
Member

@RalfJung RalfJung commented Dec 2, 2025

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

@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2025

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

@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 Dec 2, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2025

tgross35 is currently at their maximum review capacity.
They may take a while to respond.

Comment on lines 2950 to 2953
/// 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.
Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this?

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 5, 2025
…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.
rust-timer added a commit that referenced this pull request Dec 5, 2025
Rollup merge of #149671 - RalfJung:interpret-float-min-max, r=mati865

interpret: test SNaN handling of float min/max and update comments

Also see #149563.

I also renamed these enum variants so they are not almost identical.
@tgross35
Copy link
Contributor

tgross35 commented Dec 5, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 5, 2025

📌 Commit 2421920 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 Dec 5, 2025
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Dec 6, 2025
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.
bors added a commit that referenced this pull request Dec 6, 2025
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
@bors bors merged commit b53b824 into rust-lang:main Dec 6, 2025
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Dec 6, 2025
rust-timer added a commit that referenced this pull request Dec 6, 2025
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`
@RalfJung RalfJung deleted the f-min-max branch December 6, 2025 11:55
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Dec 13, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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