Skip to content

asinh and acosh return inf for very large input values #153878

@ecoricemon

Description

@ecoricemon

Description
asinh and acosh currently return inf when receiving very large values such as f64::MAX as input.

fn main() {
    let a = f64::MAX.asinh();
    let b = libm::asinh(f64::MAX);
    println!("{a}, {b}");

    let a = f64::MAX.acosh();
    let b = libm::acosh(f64::MAX);
    println!("{a}, {b}");
}
inf, 710.4758600739439
inf, 710.4758600739439

Expected Behavior
The functions should return approximately 710.475... (for f64::MAX) instead of infinity.
I found libm and go handle very large inputs by using the approximation: asinh(x)≈ln(x)+ln(2)
But, std doesn't do like so.

Meta

rustc --version --verbose:

<version>
rustc 1.96.0-nightly (1d8897a4e 2026-03-13)
binary: rustc
commit-hash: 1d8897a4e88051480b36c501e66809425c6e08ad
commit-date: 2026-03-13
host: aarch64-apple-darwin
release: 1.96.0-nightly
LLVM version: 22.1.0

P.S.
I searched for existing issues regarding large input values for these functions but couldn't find any. My apologies if this turns out to be a duplicate.

Metadata

Metadata

Assignees

Labels

A-floating-pointArea: Floating point numbers and arithmeticC-bugCategory: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions