Skip to content

Miri: handling of SNaN inputs in f*::pow operations #142514

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

LorrensP-2158466
Copy link
Contributor

@LorrensP-2158466 LorrensP-2158466 commented Jun 14, 2025

fixes miri/#4286 and related to #138062 and miri/#4208.

For the following cases of the powf or powi operations, Miri returns either 1.0 or an arbitrary NaN:

  • powf(SNaN, 0.0)
  • powf(1.0, SNaN)
  • powi(SNaN, 0)

Also added a macro in miri/tests/pass/float.rs which conveniently checks if both are indeed returned from such an operation.

Made these changes in the rust repo so I could test against stdlib, since these were impacted some time ago and were fixed in #138062. Tested with:

env MIRIFLAGS=-Zmiri-many-seeds ./x miri --no-fail-fast std core coretests -- f32 f64

This was successful. This does take a while, so I recommend using --no-doc and separate use of f32 or f64

The pr is somewhat split up into 3 main commits, which implement the cases described above. The first commit also introduces the macro, and the last commit is just a global refactor of some things.

r? @RalfJung

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 14, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 14, 2025

The Miri subtree was changed

cc @rust-lang/miri

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make powf/powi(sNaN, 0) over-approximate both glibc and musl
3 participants