Skip to content

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

Merged
bors merged 2 commits intorust-lang:masterfrom
LorrensP-2158466:miri-float-nondet-pow
Jun 30, 2025
Merged

Miri: handling of SNaN inputs in f*::pow operations#142514
bors merged 2 commits intorust-lang:masterfrom
LorrensP-2158466:miri-float-nondet-pow

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

Loading
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants