| 1 | //===-- Implementation header for nanf128 -----------------------*- C++ -*-===// |
|---|---|
| 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 | #ifndef LLVM_LIBC_SRC___SUPPORT_MATH_NANF128_H |
| 10 | #define LLVM_LIBC_SRC___SUPPORT_MATH_NANF128_H |
| 11 | |
| 12 | #include "include/llvm-libc-types/float128.h" |
| 13 | |
| 14 | #ifdef LIBC_TYPES_HAS_FLOAT128 |
| 15 | |
| 16 | #include "src/__support/libc_errno.h" |
| 17 | #include "src/__support/macros/config.h" |
| 18 | #include "src/__support/str_to_float.h" |
| 19 | |
| 20 | namespace LIBC_NAMESPACE_DECL { |
| 21 | namespace math { |
| 22 | |
| 23 | LIBC_INLINE constexpr float128 nanf128(const char *arg) { |
| 24 | auto result = internal::strtonan<float128>(arg); |
| 25 | if (result.has_error()) |
| 26 | libc_errno = result.error; |
| 27 | return result.value; |
| 28 | } |
| 29 | |
| 30 | } // namespace math |
| 31 | } // namespace LIBC_NAMESPACE_DECL |
| 32 | |
| 33 | #endif // LIBC_TYPES_HAS_FLOAT128 |
| 34 | |
| 35 | #endif // LLVM_LIBC_SRC___SUPPORT_MATH_NANF128_H |
| 36 |