|
||||
File indexing completed on 2025-01-18 10:06:50
0001 // Symbols and macros to supply platform-independent interfaces to mathematical 0002 // functions and constants. 0003 0004 #ifndef Py_PYMATH_H 0005 #define Py_PYMATH_H 0006 0007 /* High precision definition of pi and e (Euler) 0008 * The values are taken from libc6's math.h. 0009 */ 0010 #ifndef Py_MATH_PIl 0011 #define Py_MATH_PIl 3.1415926535897932384626433832795029L 0012 #endif 0013 #ifndef Py_MATH_PI 0014 #define Py_MATH_PI 3.14159265358979323846 0015 #endif 0016 0017 #ifndef Py_MATH_El 0018 #define Py_MATH_El 2.7182818284590452353602874713526625L 0019 #endif 0020 0021 #ifndef Py_MATH_E 0022 #define Py_MATH_E 2.7182818284590452354 0023 #endif 0024 0025 /* Tau (2pi) to 40 digits, taken from tauday.com/tau-digits. */ 0026 #ifndef Py_MATH_TAU 0027 #define Py_MATH_TAU 6.2831853071795864769252867665590057683943L 0028 #endif 0029 0030 // Py_IS_NAN(X) 0031 // Return 1 if float or double arg is a NaN, else 0. 0032 #define Py_IS_NAN(X) isnan(X) 0033 0034 // Py_IS_INFINITY(X) 0035 // Return 1 if float or double arg is an infinity, else 0. 0036 #define Py_IS_INFINITY(X) isinf(X) 0037 0038 // Py_IS_FINITE(X) 0039 // Return 1 if float or double arg is neither infinite nor NAN, else 0. 0040 #define Py_IS_FINITE(X) isfinite(X) 0041 0042 // Py_INFINITY: Value that evaluates to a positive double infinity. 0043 #ifndef Py_INFINITY 0044 # define Py_INFINITY ((double)INFINITY) 0045 #endif 0046 0047 /* Py_HUGE_VAL should always be the same as Py_INFINITY. But historically 0048 * this was not reliable and Python did not require IEEE floats and C99 0049 * conformity. Prefer Py_INFINITY for new code. 0050 */ 0051 #ifndef Py_HUGE_VAL 0052 # define Py_HUGE_VAL HUGE_VAL 0053 #endif 0054 0055 /* Py_NAN: Value that evaluates to a quiet Not-a-Number (NaN). The sign is 0056 * undefined and normally not relevant, but e.g. fixed for float("nan"). 0057 */ 0058 #if !defined(Py_NAN) 0059 # define Py_NAN ((double)NAN) 0060 #endif 0061 0062 #endif /* Py_PYMATH_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |