diff options
author | David Cournapeau <cournape@gmail.com> | 2009-03-11 09:22:53 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-03-11 09:22:53 +0000 |
commit | d71bd3549fef4ff4e4974c9334e140bc125e28cb (patch) | |
tree | 77277253706fd57a6447a8810f0c6c414231377f /doc/source/reference | |
parent | df219565c5598516ed7b9179e94fcc354558e007 (diff) | |
download | numpy-d71bd3549fef4ff4e4974c9334e140bc125e28cb.tar.gz |
Start documenting npy math.
Diffstat (limited to 'doc/source/reference')
-rw-r--r-- | doc/source/reference/c-api.coremath.rst | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/doc/source/reference/c-api.coremath.rst b/doc/source/reference/c-api.coremath.rst new file mode 100644 index 000000000..b0bc5916a --- /dev/null +++ b/doc/source/reference/c-api.coremath.rst @@ -0,0 +1,69 @@ +Numpy core libraries +==================== + +.. sectionauthor:: David Cournapeau + +Starting from numpy 1.3.0, we are working on separating the pure C, +"computational" code from the python dependent code. The goal is twofolds: +making the code cleaner, and enabling code reuse by other extensions outside +numpy (scipy, etc...). + +Numpy core math library +----------------------- + +The numpy core math library ('npymath') is a first step in this direction. This +library contains most math-related C99 functionalities, which can be used on +platforms where C99 is not well supported. Generally, the core math functions +have the same API as the C99 ones, except for the npy_* prefix. + +The available functions are defined in npy_math.h - please refer to this header +in doubt. + +Floating point classification +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. cvar:: NPY_NAN + + This macro is defined to a NaN (Not a Number), and is guaranteed to have + the signbit unset ('positive' NaN). The corresponding single and extension + precision macro are available with the suffix F and L. + +.. cvar:: NPY_INFINITY + + This macro is defined to a positive inf. The corresponding single and + extension precision macro are available with the suffix F and L. + +.. cvar:: NPY_PZERO + + This macro is defined to positive zero. The corresponding single and + extension precision macro are available with the suffix F and L. + +.. cvar:: NPY_NZERO + + This macro is defined to negative zero (that is with the sign bit set). The + corresponding single and extension precision macro are available with the + suffix F and L. + +.. cfunction:: int npy_isnan(x) + + This is a macro, and is equivalent to C99 isnan: works for single, double + and extended precision, and return a non 0 value is x is a NaN. + +.. cfunction:: int npy_isfinite(x) + + This is a macro, and is equivalent to C99 isfinite: works for single, + double and extended precision, and return a non 0 value is x is neither a + NaN or a infinity. + +.. cfunction:: int npy_isinf(x) + + This is a macro, and is equivalent to C99 isinf: works for single, double + and extended precision, and return a non 0 value is x is infinite (positive + and negative). + +.. cfunction:: int npy_signbit(x) + + This is a macro, and is equivalent to C99 signbit: works for single, double + and extended precision, and return a non 0 value is x has the signbit set + (that is the number is negative). + |