| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | /// |
| 9 | /// \file |
| 10 | /// Implementation header for nanf128. |
| 11 | /// |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_LIBC_SRC___SUPPORT_MATH_NANF128_H |
| 15 | #define LLVM_LIBC_SRC___SUPPORT_MATH_NANF128_H |
| 16 | |
| 17 | #include "src/__support/FPUtil/float128.h" |
| 18 | #include "src/__support/libc_errno.h" |
| 19 | #include "src/__support/macros/config.h" |
| 20 | #include "src/__support/str_to_float.h" |
| 21 | |
| 22 | namespace LIBC_NAMESPACE_DECL { |
| 23 | namespace math { |
| 24 | |
| 25 | using LIBC_NAMESPACE::fputil::Float128; |
| 26 | |
| 27 | LIBC_INLINE constexpr Float128 nanf128(const char *arg) { |
| 28 | auto result = internal::strtonan<Float128>(arg); |
| 29 | if (result.has_error()) |
| 30 | libc_errno = result.error; |
| 31 | return result.value; |
| 32 | } |
| 33 | |
| 34 | } // namespace math |
| 35 | } // namespace LIBC_NAMESPACE_DECL |
| 36 | |
| 37 | #endif // LLVM_LIBC_SRC___SUPPORT_MATH_NANF128_H |
| 38 |