Skip to content

f32/64::asinh() should return -0.0 for -0.0 #63271

Closed
@TimothyGu

Description

@TimothyGu

Currently, both of the following return false:

(-0.0 as f64).asinh().is_sign_negative()
(-0.0 as f32).asinh().is_sign_negative()

However, in other languages like C, asinh(-0.0) would always return -0.0. We might need another fast case for 0.0 and -0.0 here:

rust/src/libstd/f64.rs

Lines 833 to 839 in f01b9f8

pub fn asinh(self) -> f64 {
if self == NEG_INFINITY {
NEG_INFINITY
} else {
(self + ((self * self) + 1.0).sqrt()).ln()
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-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