Skip to content

f32 and f64 powf NaN handling should be documented #90429

Closed
@jimblandy

Description

@jimblandy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-floating-pointArea: Floating point numbers and arithmeticC-bugCategory: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions