Skip to content

min,max: Add tests for signaling NaNs and update documentation#1104

Open
tgross35 wants to merge 4 commits intorust-lang:mainfrom
tgross35:min-max-snan
Open

min,max: Add tests for signaling NaNs and update documentation#1104
tgross35 wants to merge 4 commits intorust-lang:mainfrom
tgross35:min-max-snan

Conversation

@tgross35
Copy link
Contributor

@tgross35 tgross35 commented Mar 6, 2026

We do handle signaling NaNs properly, with the exception of raising
exceptions as IEEE 754 requires. Add tests to this effect for
fmin, fminimum, fminimum_num, and the max variants.

ci: allow-many-extensive
ci: allow-regressions (hex float printing)

@tgross35
Copy link
Contributor Author

tgross35 commented Mar 6, 2026

Cc @RalfJung

@tgross35 tgross35 force-pushed the min-max-snan branch 2 times, most recently from 73da7c9 to 5fa14cd Compare March 6, 2026 04:51
@rustbot

This comment has been minimized.

//! - qNaN if either operation is NaN
//!
//! Excluded from our implementation is sNaN handling.
//! Note that the IEEE 754-2019 specifies that a sNaN in eitt her argument should signal invalid,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
//! Note that the IEEE 754-2019 specifies that a sNaN in eitt her argument should signal invalid,
//! Note that the IEEE 754-2019 specifies that a sNaN in either argument should signal invalid,

happens a few times

@tgross35 tgross35 force-pushed the min-max-snan branch 3 times, most recently from 09291aa to 68b91db Compare March 6, 2026 09:20
@rustbot

This comment has been minimized.

@tgross35 tgross35 force-pushed the min-max-snan branch 5 times, most recently from 5d9b1bf to 25e3d07 Compare March 6, 2026 12:47
Add a wrapper similar to `Hexf` to print integers with proper padding.
@rustbot
Copy link
Collaborator

rustbot commented Mar 6, 2026

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.

tgross35 added 3 commits March 6, 2026 08:18
Make `Float::NAN` a qNaN, add sNaNs, and add operations to check whether
a NaN is quiet or signaling.
Give more descriptive output in tests since we sometimes need to treat
these differently. We still don't parse `sNaN`/`qNaN` for now, though we
could in the future.
We do handle signaling NaNs properly, with the exception of raising
exceptions as IEEE 754 requires. Add tests to this effect for
`fmin`, `fminimum`, `fminimum_num`, and the max variants.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants