OLD | NEW |
1 #ifndef Py_PYMATH_H | 1 #ifndef Py_PYMATH_H |
2 #define Py_PYMATH_H | 2 #define Py_PYMATH_H |
3 | 3 |
4 #include "pyconfig.h" /* include for defines */ | 4 #include "pyconfig.h" /* include for defines */ |
5 | 5 |
6 /************************************************************************** | 6 /************************************************************************** |
7 Symbols and macros to supply platform-independent interfaces to mathematical | 7 Symbols and macros to supply platform-independent interfaces to mathematical |
8 functions and constants | 8 functions and constants |
9 **************************************************************************/ | 9 **************************************************************************/ |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 * Return 1 if float or double arg is an infinity, else 0. | 100 * Return 1 if float or double arg is an infinity, else 0. |
101 * Caution: | 101 * Caution: |
102 * X is evaluated more than once. | 102 * X is evaluated more than once. |
103 * This implementation may set the underflow flag if |X| is very small; | 103 * This implementation may set the underflow flag if |X| is very small; |
104 * it really can't be implemented correctly (& easily) before C99. | 104 * it really can't be implemented correctly (& easily) before C99. |
105 * Override in pyconfig.h if you have a better spelling on your platform. | 105 * Override in pyconfig.h if you have a better spelling on your platform. |
106 * Py_FORCE_DOUBLE is used to avoid getting false negatives from a | 106 * Py_FORCE_DOUBLE is used to avoid getting false negatives from a |
107 * non-infinite value v sitting in an 80-bit x87 register such that | 107 * non-infinite value v sitting in an 80-bit x87 register such that |
108 * v becomes infinite when spilled from the register to 64-bit memory. | 108 * v becomes infinite when spilled from the register to 64-bit memory. |
109 * Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf | 109 * Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf |
| 110 * FIXME: PC/pyconfig.h defines Py_IS_INFINITY as (!_finite(X) && !_isnan(X)) |
| 111 * so that above note isn't correct !!! |
110 */ | 112 */ |
111 #ifndef Py_IS_INFINITY | 113 #ifndef Py_IS_INFINITY |
112 # if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1 | 114 # if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1 |
113 # define Py_IS_INFINITY(X) isinf(X) | 115 # define Py_IS_INFINITY(X) isinf(X) |
114 # else | 116 # else |
115 # define Py_IS_INFINITY(X) ((X) && \ | 117 # define Py_IS_INFINITY(X) ((X) && \ |
116 (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X))) | 118 (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X))) |
117 # endif | 119 # endif |
118 #endif | 120 #endif |
119 | 121 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 */ | 183 */ |
182 #if defined(__FreeBSD__) || defined(__OpenBSD__) | 184 #if defined(__FreeBSD__) || defined(__OpenBSD__) |
183 #define Py_OVERFLOWED(X) isinf(X) | 185 #define Py_OVERFLOWED(X) isinf(X) |
184 #else | 186 #else |
185 #define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \ | 187 #define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \ |
186 (X) == Py_HUGE_VAL || \ | 188 (X) == Py_HUGE_VAL || \ |
187 (X) == -Py_HUGE_VAL)) | 189 (X) == -Py_HUGE_VAL)) |
188 #endif | 190 #endif |
189 | 191 |
190 #endif /* Py_PYMATH_H */ | 192 #endif /* Py_PYMATH_H */ |
OLD | NEW |