diff options
author | David Cournapeau <cournape@gmail.com> | 2009-03-11 07:40:28 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-03-11 07:40:28 +0000 |
commit | 43399b799cb80922b1a57acae7e44318a600e178 (patch) | |
tree | a7b1ca6f57e555c253fb407346f7531223f80c2f | |
parent | 8f15bfc95cd5a7dfeffd4b95b34241619fdf2100 (diff) | |
download | numpy-43399b799cb80922b1a57acae7e44318a600e178.tar.gz |
Remove pzero/pinf init functions, and use NPY_* macros instead.
-rw-r--r-- | numpy/core/src/umathmodule.c.src | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/numpy/core/src/umathmodule.c.src b/numpy/core/src/umathmodule.c.src index 28e89ee6b..d2b4b9c8a 100644 --- a/numpy/core/src/umathmodule.c.src +++ b/numpy/core/src/umathmodule.c.src @@ -120,40 +120,6 @@ InitOtherOperators(PyObject *dictionary) { return; } -/* Setup +inf and +0 */ - -static double -pinf_init(void) -{ - double mul = 1e10; - double tmp = 0.0; - double pinf; - - pinf = mul; - for (;;) { - pinf *= mul; - if (pinf == tmp) break; - tmp = pinf; - } - return pinf; -} - -static double -pzero_init(void) -{ - double div = 1e10; - double tmp = 0.0; - double pinf; - - pinf = div; - for (;;) { - pinf /= div; - if (pinf == tmp) break; - tmp = pinf; - } - return pinf; -} - /* Setup the umath module */ /* Remove for time being, it is declared in __ufunc_api.h */ /*static PyTypeObject PyUFunc_Type;*/ @@ -170,7 +136,6 @@ static struct PyMethodDef methods[] = { PyMODINIT_FUNC initumath(void) { PyObject *m, *d, *s, *s2, *c_api; - double pinf, pzero; int UFUNC_FLOATING_POINT_SUPPORT = 1; #ifdef NO_UFUNC_FLOATING_POINT_SUPPORT @@ -245,13 +210,10 @@ PyMODINIT_FUNC initumath(void) { #undef ADDSCONST PyModule_AddIntConstant(m, "UFUNC_BUFSIZE_DEFAULT", (long)PyArray_BUFSIZE); - pinf = pinf_init(); - pzero = pzero_init(); - - PyModule_AddObject(m, "PINF", PyFloat_FromDouble(pinf)); - PyModule_AddObject(m, "NINF", PyFloat_FromDouble(-pinf)); - PyModule_AddObject(m, "PZERO", PyFloat_FromDouble(pzero)); - PyModule_AddObject(m, "NZERO", PyFloat_FromDouble(-pzero)); + PyModule_AddObject(m, "PINF", PyFloat_FromDouble(NPY_INFINITY)); + PyModule_AddObject(m, "NINF", PyFloat_FromDouble(-NPY_INFINITY)); + PyModule_AddObject(m, "PZERO", PyFloat_FromDouble(NPY_PZERO)); + PyModule_AddObject(m, "NZERO", PyFloat_FromDouble(NPY_NZERO)); PyModule_AddObject(m, "NAN", PyFloat_FromDouble(NPY_NAN)); s = PyDict_GetItemString(d, "conjugate"); |