[libc-commits] [libc] [libc][math] Fix `tanpif` and `tanpif16` error handling (PR #235296)
via libc-commits
libc-commits at lists.llvm.org
Sat Oct 24 09:10:22 PDT 2026
================
@@ -62,13 +62,22 @@ LIBC_INLINE float tanpif(float x) {
if (LIBC_UNLIKELY(x_abs == 0U))
return x;
+ // tanpi(x) underflows for 0 < |x| <= 0x1.45f3p-128.
+ if (LIBC_UNLIKELY(x_abs <= 0x0028'be60U))
+ fputil::set_errno_if_required(ERANGE);
----------------
lntue wrote:
Move the check `x_abs == 0U` above inside this branch to reduce the number of branches in the top level.
https://github.com/llvm/llvm-project/pull/235296
More information about the libc-commits
mailing list