[Numpy-discussion] Portable macro to get NAN, INF, positive and negative zero

Charles R Harris charlesr.harris at gmail.com
Wed Mar 11 11:02:03 EDT 2009


On Wed, Mar 11, 2009 at 12:43 AM, David Cournapeau <
david at ar.media.kyoto-u.ac.jp> wrote:

> Hi,
>
>    For the record, I have just added the following functionalities to
> numpy, which may simplify some C code:
>    - NPY_NAN/NPY_INFINITY/NPY_PZERO/NPY_NZERO: macros to get nan, inf,
> positive and negative zeros. Rationale: some code use NAN, _get_nan,
> etc... NAN is a GNU C extension, INFINITY is not available on many C
> compilers. The NPY_ macros are defined from the IEEE754 format, and as
> such should be very fast (the values should be inlined).
>    - we can now use inline safely in numpy C code: it is defined to
> something recognized by the compiler or nothing if inline is not
> supported. It is NOT defined publicly to avoid namespace pollution.
>    - NPY_INLINE is a macro which can be used publicly, and has the same
> usage as inline.
>

Great. This should be helpful.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090311/49a4a008/attachment.html>


More information about the NumPy-Discussion mailing list