[libc-commits] [llvm] [libc] [libc][math] Implement nan(f|l) functions (PR #76690)
via libc-commits
libc-commits at lists.llvm.org
Tue Jan 2 05:57:18 PST 2024
================
@@ -0,0 +1,26 @@
+//===-- Implementation of nanl function -----------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/nanl.h"
+#include "src/__support/common.h"
+#include "src/__support/str_to_float.h"
+#include "src/errno/libc_errno.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, nanl, (const char *arg)) {
+ const char *fp_str = internal::nan_str_to_floatingpoint_str(arg);
+ auto result = internal::strtofloatingpoint<long double>(fp_str);
----------------
lntue wrote:
+1 for refactoring the NaN handling from `strtofloatingpoint` to reuse for `nan*` implementations.
https://github.com/llvm/llvm-project/pull/76690
More information about the libc-commits
mailing list