Skip to content
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

Open
jimblandy opened this issue Oct 31, 2021 · 1 comment
Open

f32 and f64 powf NaN handling should be documented #90429

jimblandy opened this issue Oct 31, 2021 · 1 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.

Comments

@jimblandy
Copy link
Contributor

The f32 and f64 powf methods follow the IEEE 754-2008 recommendations for NaN handling, but these are quite surprising. For example, f64::powf(1.0, f64::NAN) returns 1.0, not f64::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.

@jimblandy jimblandy added the C-bug Category: This is a bug. label Oct 31, 2021
@camelid camelid added 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 T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Oct 31, 2021
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
hkBst added a commit to hkBst/rust that referenced this issue Jan 24, 2025
@hkBst
Copy link
Member

hkBst commented Jan 24, 2025

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.
Projects
None yet
Development

No branches or pull requests

3 participants