mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-24 04:56:07 +00:00

In IEEE 754 and C standards, when calling `frexp` with Inf/Nan inputs, the exponent result is unspecified. In this case, FreeBSD libc and musl just passthrough `exp`, while glibc, FreeBSD libm set exp = 0, and MSVC set exp = -1. By default, LLVM libc will passthrough `exp` just as FreeBSD libc and musl, but we also allow users to explicitly choose the return exp value in this case for compatibility with other libc. Notice that, gcc did generate passthrough `exp` for `frexp(NaN/Inf, exp)`: https://godbolt.org/z/sM8fEej4E