xref: /llvm-project/libc/src/math/generic/nanf16.cpp (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
1cb1a727dSOverMighty //===-- Implementation of nanf16 function ---------------------------------===//
2cb1a727dSOverMighty //
3cb1a727dSOverMighty // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4cb1a727dSOverMighty // See https://llvm.org/LICENSE.txt for license information.
5cb1a727dSOverMighty // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6cb1a727dSOverMighty //
7cb1a727dSOverMighty //===----------------------------------------------------------------------===//
8cb1a727dSOverMighty 
9cb1a727dSOverMighty #include "src/math/nanf16.h"
10cb1a727dSOverMighty #include "src/__support/common.h"
11*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
12cb1a727dSOverMighty #include "src/__support/str_to_float.h"
13cb1a727dSOverMighty #include "src/errno/libc_errno.h"
14cb1a727dSOverMighty 
15*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
16cb1a727dSOverMighty 
17cb1a727dSOverMighty LLVM_LIBC_FUNCTION(float16, nanf16, (const char *arg)) {
18cb1a727dSOverMighty   auto result = internal::strtonan<float16>(arg);
19cb1a727dSOverMighty   if (result.has_error())
20cb1a727dSOverMighty     libc_errno = result.error;
21cb1a727dSOverMighty   return result.value;
22cb1a727dSOverMighty }
23cb1a727dSOverMighty 
24*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
25