-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticC-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
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.
curiousdannii and Scripter17
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticC-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.