#include <Python.h>
#include <math.h>
#include "npy_config.h"
#include "npy_fpmath.h"
#include "numpy/npy_math.h"
#include "numpy/npy_cpu.h"
#include "numpy/npy_endian.h"
#include "numpy/npy_common.h"
Go to the source code of this file.
Data Structures |
union | ieee_double_shape_type |
union | ieee_double_shape_type |
union | ieee_float_shape_type |
union | __npy_cdouble_to_c99_cast |
union | __npy_cfloat_to_c99_cast |
union | __npy_clongdouble_to_c99_cast |
Defines |
#define | IEEE_WORD_ORDER NPY_BYTE_ORDER |
#define | EXTRACT_WORDS(ix0, ix1, d) |
#define | GET_HIGH_WORD(i, d) |
#define | GET_LOW_WORD(i, d) |
#define | SET_HIGH_WORD(d, v) |
#define | SET_LOW_WORD(d, v) |
#define | INSERT_WORDS(d, ix0, ix1) |
#define | GET_FLOAT_WORD(i, d) |
#define | SET_FLOAT_WORD(d, i) |
#define | GET_LDOUBLE_SIGN(x) (((x).a[LDBL_SIGN_INDEX] & LDBL_SIGN_MASK) >> LDBL_SIGN_SHIFT) |
#define | SET_LDOUBLE_SIGN(x, v) |
#define | GET_LDOUBLE_EXP(x) (((x).a[LDBL_EXP_INDEX] & LDBL_EXP_MASK) >> LDBL_EXP_SHIFT) |
#define | SET_LDOUBLE_EXP(x, v) |
#define | GET_LDOUBLE_MANL(x) (((x).a[LDBL_MANL_INDEX] & LDBL_MANL_MASK) >> LDBL_MANL_SHIFT) |
#define | SET_LDOUBLE_MANL(x, v) |
#define | GET_LDOUBLE_MANH(x) (((x).a[LDBL_MANH_INDEX] & LDBL_MANH_MASK) >> LDBL_MANH_SHIFT) |
#define | SET_LDOUBLE_MANH(x, v) |
Define Documentation
Value:do { \
ieee_double_shape_type ew_u; \
ew_u.value = (d); \
(ix0) = ew_u.parts.msw; \
(ix1) = ew_u.parts.lsw; \
} while (0)
Get two 32 bit ints from a double.
Referenced by _next().
Value:do { \
ieee_float_shape_type gf_u; \
gf_u.value = (d); \
(i) = gf_u.word; \
} while (0)
Get a 32 bit int from a float.
Value:do { \
ieee_double_shape_type gh_u; \
gh_u.value = (d); \
(i) = gh_u.parts.msw; \
} while (0)
Get the more significant 32 bit int from a double.
Referenced by npy_copysign().
#define GET_LDOUBLE_EXP |
( |
|
x | ) |
(((x).a[LDBL_EXP_INDEX] & LDBL_EXP_MASK) >> LDBL_EXP_SHIFT) |
Get the exp bits of x. x should be of type IEEEl2bitsrep
#define GET_LDOUBLE_MANH |
( |
|
x | ) |
(((x).a[LDBL_MANH_INDEX] & LDBL_MANH_MASK) >> LDBL_MANH_SHIFT) |
Get the manh bits of x. x should be of type IEEEl2bitsrep
#define GET_LDOUBLE_MANL |
( |
|
x | ) |
(((x).a[LDBL_MANL_INDEX] & LDBL_MANL_MASK) >> LDBL_MANL_SHIFT) |
Get the manl bits of x. x should be of type IEEEl2bitsrep
#define GET_LDOUBLE_SIGN |
( |
|
x | ) |
(((x).a[LDBL_SIGN_INDEX] & LDBL_SIGN_MASK) >> LDBL_SIGN_SHIFT) |
Long double support
Get the sign bit of x. x should be of type IEEEl2bitsrep
Value:do { \
ieee_double_shape_type gl_u; \
gl_u.value = (d); \
(i) = gl_u.parts.lsw; \
} while (0)
Get the less significant 32 bit int from a double.
from: @(#)fdlibm.h 5.1 93/09/24 $FreeBSD$
- The original fdlibm code used statements like:
- n0 = (((int)&one)>>29)^1; * index of high word * ix0 = (n0+(int)&x); * high word of x * ix1 = ((1-n0)+(int)&x); * low word of x *
System Message: WARNING/2 (<string>
, line 5) Definition list ends without a blank line; unexpected unindent.
to dig two 32 bit words out of the 64 bit IEEE floating point value. That is non-ANSI, and, moreover, the gcc instruction scheduler gets it wrong. We instead use the following macros. Unlike the original code, we determine the endianness at compile time, not at run time; I don't see much benefit to selecting endianness at run time.
A union which permits us to convert between a double and two 32 bit ints.
XXX: not really, but we already make this assumption elsewhere. Will have to fix this at some point
Value:do { \
ieee_double_shape_type iw_u; \
iw_u.parts.msw = (ix0); \
iw_u.parts.lsw = (ix1); \
(d) = iw_u.value; \
} while (0)
Set a double from two 32 bit ints.
Referenced by _next().
Value:do { \
ieee_float_shape_type sf_u; \
sf_u.word = (i); \
(d) = sf_u.value; \
} while (0)
Set a float from a 32 bit int.
Referenced by _nextl().
Value:do { \
ieee_double_shape_type sh_u; \
sh_u.value = (d); \
sh_u.parts.msw = (v); \
(d) = sh_u.value; \
} while (0)
Set the more significant 32 bits of a double from an int.
Referenced by npy_copysign().
Value:((x).a[LDBL_EXP_INDEX] = \
((x).a[LDBL_EXP_INDEX] & ~LDBL_EXP_MASK) | \
(((IEEEl2bitsrep_part)(v) << LDBL_EXP_SHIFT) & LDBL_EXP_MASK))
Set the exp bit of x to v. x should be of type IEEEl2bitsrep
Value:((x).a[LDBL_MANH_INDEX] = \
((x).a[LDBL_MANH_INDEX] & ~LDBL_MANH_MASK) | \
(((IEEEl2bitsrep_part)(v) << LDBL_MANH_SHIFT) & LDBL_MANH_MASK))
Set the manh bit of x to v. x should be of type IEEEl2bitsrep
#ifndef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE
Value:((x).a[LDBL_MANL_INDEX] = \
((x).a[LDBL_MANL_INDEX] & ~LDBL_MANL_MASK) | \
(((IEEEl2bitsrep_part)(v) << LDBL_MANL_SHIFT) & LDBL_MANL_MASK))
Set the manl bit of x to v. x should be of type IEEEl2bitsrep
Value:((x).a[LDBL_SIGN_INDEX] = \
((x).a[LDBL_SIGN_INDEX] & ~LDBL_SIGN_MASK) | \
(((IEEEl2bitsrep_part)(v) << LDBL_SIGN_SHIFT) & LDBL_SIGN_MASK))
Set the sign bit of x to v. x should be of type IEEEl2bitsrep
Value:do { \
ieee_double_shape_type sl_u; \
sl_u.value = (d); \
sl_u.parts.lsw = (v); \
(d) = sl_u.value; \
} while (0)
Set the less significant 32 bits of a double from an int.