-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
f32
and f64
powf
NaN handling should be documented
#90429
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
A-floating-point
Area: Floating point numbers and arithmetic
C-bug
Category: This is a bug.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Comments
hkBst
added a commit
to hkBst/rust
that referenced
this issue
Jan 24, 2025
f64 part for bug rust-lang#90429
hkBst
added a commit
to hkBst/rust
that referenced
this issue
Jan 24, 2025
hkBst
added a commit
to hkBst/rust
that referenced
this issue
Jan 24, 2025
hkBst
added a commit
to hkBst/rust
that referenced
this issue
Jan 24, 2025
f128 part for bug rust-lang#90429
Once these 4 PRs are merged this can be closed. |
Zalathar
added a commit
to Zalathar/rust
that referenced
this issue
Jan 28, 2025
Document powf and powi values that are always 1.0 fixes bug rust-lang#90429
Zalathar
added a commit
to Zalathar/rust
that referenced
this issue
Jan 28, 2025
Document powf and powi values that are always 1.0 fixes bug rust-lang#90429
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jan 28, 2025
…gross35 Document powf and powi values that are always 1.0 fixes bug rust-lang#90429
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jan 28, 2025
…gross35 Document powf and powi values that are always 1.0 fixes bug rust-lang#90429
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jan 28, 2025
Rollup merge of rust-lang#136012 - hkBst:patch-22, r=workingjubilee,tgross35 Document powf and powi values that are always 1.0 fixes bug rust-lang#90429
github-actions bot
pushed a commit
to tautschnig/verify-rust-std
that referenced
this issue
Mar 11, 2025
…gross35 Document powf and powi values that are always 1.0 fixes bug rust-lang#90429
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
A-floating-point
Area: Floating point numbers and arithmetic
C-bug
Category: This is a bug.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
The
f32
andf64
powf
methods follow the IEEE 754-2008 recommendations for NaN handling, but these are quite surprising. For example,f64::powf(1.0, f64::NAN)
returns1.0
, notf64::NAN
. This behavior should be documented.The current docs don't mention NaN at all, which leads one to assume that any argument being NaN would produce a NaN result, like arithmetic operations. But these are not the standard behavior for
powf
.This was mentioned in #60468, which links a playground illustrating the exceptions.
The text was updated successfully, but these errors were encountered: