Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/system/lib/llvm-libc/include/llvm-libc-macros/math-macros.h
6172 views
1
//===-- Definition of 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_MACROS_H
10
#define LLVM_LIBC_MACROS_MATH_MACROS_H
11
12
#include "limits-macros.h"
13
14
#define FP_NAN 0
15
#define FP_INFINITE 1
16
#define FP_ZERO 2
17
#define FP_SUBNORMAL 3
18
#define FP_NORMAL 4
19
20
#define FP_INT_UPWARD 0
21
#define FP_INT_DOWNWARD 1
22
#define FP_INT_TOWARDZERO 2
23
#define FP_INT_TONEARESTFROMZERO 3
24
#define FP_INT_TONEAREST 4
25
26
#define MATH_ERRNO 1
27
#define MATH_ERREXCEPT 2
28
29
#define HUGE_VAL __builtin_huge_val()
30
#define HUGE_VALF __builtin_huge_valf()
31
#define INFINITY __builtin_inff()
32
#define NAN __builtin_nanf("")
33
34
#define FP_ILOGB0 (-INT_MAX - 1)
35
#define FP_LLOGB0 (-LONG_MAX - 1)
36
37
#ifdef __FP_LOGBNAN_MIN
38
#define FP_ILOGBNAN (-INT_MAX - 1)
39
#define FP_LLOGBNAN (-LONG_MAX - 1)
40
#else
41
#define FP_ILOGBNAN INT_MAX
42
#define FP_LLOGBNAN LONG_MAX
43
#endif
44
45
#if defined(__NVPTX__) || defined(__AMDGPU__) || defined(__FAST_MATH__)
46
#define math_errhandling 0
47
#elif defined(__NO_MATH_ERRNO__)
48
#define math_errhandling (MATH_ERREXCEPT)
49
#else
50
#define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT)
51
#endif
52
53
#endif // LLVM_LIBC_MACROS_MATH_MACROS_H
54
55