[libc-commits] [libc] [libc] Fix signed zeros for exp10m1f16. (PR #116654)
via libc-commits
libc-commits at lists.llvm.org
Mon Nov 18 08:55:04 PST 2024
https://github.com/lntue created https://github.com/llvm/llvm-project/pull/116654
None
>From 3edd9139c70f491cb3ce9c3a9bf1c9625397e69a Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Mon, 18 Nov 2024 11:53:39 -0500
Subject: [PATCH] [libc] Fix signed zeros for exp10m1f16.
---
libc/src/math/generic/exp10m1f16.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libc/src/math/generic/exp10m1f16.cpp b/libc/src/math/generic/exp10m1f16.cpp
index 9f2c1959fa5ec9..449aedf254ca50 100644
--- a/libc/src/math/generic/exp10m1f16.cpp
+++ b/libc/src/math/generic/exp10m1f16.cpp
@@ -119,6 +119,9 @@ LLVM_LIBC_FUNCTION(float16, exp10m1f16, (float16 x)) {
// When |x| <= 2^(-3).
if (x_abs <= 0x3000U) {
+ if (LIBC_UNLIKELY(x_abs == 0))
+ return x;
+
if (auto r = EXP10M1F16_EXCEPTS_LO.lookup(x_u);
LIBC_UNLIKELY(r.has_value()))
return r.value();
More information about the libc-commits
mailing list