xref: /llvm-project/libc/include/llvm-libc-macros/math-function-macros.h (revision b935d312f13a95388113093e8ac4ae3037cb7842)
1 //===-- Definition of function macros from math.h -------------------------===//
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_MACROS_MATH_FUNCTION_MACROS_H
10 #define LLVM_LIBC_MACROS_MATH_FUNCTION_MACROS_H
11 
12 #include "math-macros.h"
13 
14 #define isfinite(x) __builtin_isfinite(x)
15 #define isinf(x) __builtin_isinf(x)
16 #define isnan(x) __builtin_isnan(x)
17 #define signbit(x) __builtin_signbit(x)
18 #define iszero(x) (x == 0)
19 #define fpclassify(x)                                                          \
20   __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x)
21 #define isnormal(x) __builtin_isnormal(x)
22 #define issubnormal(x) (fpclassify(x) == FP_SUBNORMAL)
23 #if (defined(__clang__) && __clang_major__ >= 18) ||                           \
24     (defined(__GNUC__) && __GNUC__ >= 13)
25 #define issignaling(x) __builtin_issignaling(x)
26 #endif
27 
28 #endif // LLVM_LIBC_MACROS_MATH_FUNCTION_MACROS_H
29