Skip to content

powf for NaN returns 1 #60468

Closed
Closed
@CodeSandwich

Description

@CodeSandwich

The powf for floating point numbers seems to have optimization: when base is 1, always return 1. This optimization does not check if exponent is a number, so

1f32.powf(std::f32::NAN) == 1.

This behavior is same for debug and release modes, f32 and f64. playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions