[Numpy-svn] r4582 - in branches/numpy.scons: . numpy/core numpy/core/code_generators numpy/core/include/numpy numpy/core/src numpy/core/tests numpy/distutils numpy/distutils/command numpy/numarray
numpy-svn at scipy.org
numpy-svn at scipy.org
Fri Dec 14 21:54:15 EST 2007
Author: cdavid
Date: 2007-12-14 20:53:30 -0600 (Fri, 14 Dec 2007)
New Revision: 4582
Added:
branches/numpy.scons/numpy/distutils/command/develop.py
Modified:
branches/numpy.scons/
branches/numpy.scons/numpy/core/code_generators/generate_umath.py
branches/numpy.scons/numpy/core/include/numpy/ufuncobject.h
branches/numpy.scons/numpy/core/numeric.py
branches/numpy.scons/numpy/core/src/arraymethods.c
branches/numpy.scons/numpy/core/src/arraytypes.inc.src
branches/numpy.scons/numpy/core/src/multiarraymodule.c
branches/numpy.scons/numpy/core/src/umathmodule.c.src
branches/numpy.scons/numpy/core/tests/test_multiarray.py
branches/numpy.scons/numpy/core/tests/test_umath.py
branches/numpy.scons/numpy/distutils/command/build_scripts.py
branches/numpy.scons/numpy/distutils/command/egg_info.py
branches/numpy.scons/numpy/distutils/core.py
branches/numpy.scons/numpy/numarray/_capi.c
Log:
Merged revisions 4555-4581 via svnmerge from
http://svn.scipy.org/svn/numpy/trunk
........
r4566 | oliphant | 2007-12-11 13:48:31 +0900 (Tue, 11 Dec 2007) | 1 line
Allow clip method to have either min or max passed in.
........
r4567 | oliphant | 2007-12-11 14:51:28 +0900 (Tue, 11 Dec 2007) | 1 line
Re-work slow clip to use minimum followed by maximum.
........
r4569 | rkern | 2007-12-13 05:12:10 +0900 (Thu, 13 Dec 2007) | 1 line
Make the 'develop' command from setuptools run build_src --inplace in addition to build_ext --inplace. This allows SWIG wrappers to be correctly generated.
........
r4570 | rkern | 2007-12-13 08:59:59 +0900 (Thu, 13 Dec 2007) | 1 line
Make sure the develop command can handle generated script files.
........
r4571 | dhuard | 2007-12-14 04:24:43 +0900 (Fri, 14 Dec 2007) | 1 line
Fixed binary_repr to make sure that evaluation at 0 returns a string of length width.
........
r4572 | stefan | 2007-12-14 22:39:15 +0900 (Fri, 14 Dec 2007) | 2 lines
Fix building on freebsd [patch by Joe Peterson].
........
r4575 | cookedm | 2007-12-15 07:19:54 +0900 (Sat, 15 Dec 2007) | 2 lines
Add degrees() and radians() ufuncs
........
r4579 | stefan | 2007-12-15 11:07:45 +0900 (Sat, 15 Dec 2007) | 2 lines
Assign default values to max_val and min_val to prevent compiler warnings.
........
Property changes on: branches/numpy.scons
___________________________________________________________________
Name: svnmerge-integrated
- /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /trunk:1-4554
+ /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /trunk:1-4581
Modified: branches/numpy.scons/numpy/core/code_generators/generate_umath.py
===================================================================
--- branches/numpy.scons/numpy/core/code_generators/generate_umath.py 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/core/code_generators/generate_umath.py 2007-12-15 02:53:30 UTC (rev 4582)
@@ -5,6 +5,16 @@
None_ = "PyUFunc_None"
class TypeDescription(object):
+ """Type signature for a ufunc
+
+ Attributes
+ ----------
+
+ type: character representing the type
+ func_data:
+ in_:
+ out:
+ """
def __init__(self, type, f=None, in_=None, out=None):
self.type = type
self.func_data = f
@@ -55,6 +65,17 @@
return tds
class Ufunc(object):
+ """Description of a ufunc.
+
+ Attributes
+ ----------
+
+ nin: number of input arguments
+ nout: number of output arguments
+ identity: identity element for a two-argument function
+ docstring: docstring for the ufunc
+ type_descriptions: list of TypeDescription objects
+ """
def __init__(self, nin, nout, identity, docstring,
*type_descriptions):
self.nin = nin
@@ -69,7 +90,7 @@
for td in self.type_descriptions:
td.finish_signature(self.nin, self.nout)
-#each entry in defdict is
+#each entry in defdict is a Ufunc object.
#name: [string of chars for which it is defined,
# string of characters using func interface,
@@ -304,6 +325,16 @@
TD(ints),
TD(O, f='PyNumber_Rshift'),
),
+'degrees' :
+ Ufunc(1, 1, None,
+ 'converts angle from radians to degrees',
+ TD(fltsM, f='degrees'),
+ ),
+'radians' :
+ Ufunc(1, 1, None,
+ 'converts angle from degrees to radians',
+ TD(fltsM, f='radians'),
+ ),
'arccos' :
Ufunc(1, 1, None,
'inverse cosine elementwise.',
Modified: branches/numpy.scons/numpy/core/include/numpy/ufuncobject.h
===================================================================
--- branches/numpy.scons/numpy/core/include/numpy/ufuncobject.h 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/core/include/numpy/ufuncobject.h 2007-12-15 02:53:30 UTC (rev 4582)
@@ -223,6 +223,10 @@
/* This code checks the IEEE status flags in a platform-dependent way */
/* Adapted from Numarray */
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
+#include <sys/param.h>
+#endif
+
/* OSF/Alpha (Tru64) ---------------------------------------------*/
#if defined(__osf__) && defined(__alpha)
@@ -267,7 +271,7 @@
/* Solaris --------------------------------------------------------*/
/* --------ignoring SunOS ieee_flags approach, someone else can
** deal with that! */
-#elif defined(sun) || defined(__BSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
+#elif defined(sun) || defined(__BSD__) || defined(__OpenBSD__) || (defined(__FreeBSD__) && (__FreeBSD_version < 502114)) || defined(__NetBSD__)
#include <ieeefp.h>
#define UFUNC_CHECK_STATUS(ret) { \
@@ -281,9 +285,9 @@
(void) fpsetsticky(0); \
}
-#elif defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__)
+#elif defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
-#if defined(__GLIBC__) || defined(__APPLE__) || defined(__MINGW32__)
+#if defined(__GLIBC__) || defined(__APPLE__) || defined(__MINGW32__) || defined(__FreeBSD__)
#include <fenv.h>
#elif defined(__CYGWIN__)
#include "fenv/fenv.c"
Modified: branches/numpy.scons/numpy/core/numeric.py
===================================================================
--- branches/numpy.scons/numpy/core/numeric.py 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/core/numeric.py 2007-12-15 02:53:30 UTC (rev 4582)
@@ -565,7 +565,7 @@
# replace num with its 2-complement
num = 2**width + num
elif num == 0:
- return '0'
+ return '0'*(width or 1)
ostr = hex(num)
bin = ''.join([_lkup[ch] for ch in ostr[2:]])
bin = bin.lstrip('0')
Modified: branches/numpy.scons/numpy/core/src/arraymethods.c
===================================================================
--- branches/numpy.scons/numpy/core/src/arraymethods.c 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/core/src/arraymethods.c 2007-12-15 02:53:30 UTC (rev 4582)
@@ -1646,16 +1646,20 @@
static PyObject *
array_clip(PyArrayObject *self, PyObject *args, PyObject *kwds)
{
- PyObject *min, *max;
+ PyObject *min=NULL, *max=NULL;
PyArrayObject *out=NULL;
static char *kwlist[] = {"min", "max", "out", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO|O&", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOO&", kwlist,
&min, &max,
PyArray_OutputConverter,
&out))
return NULL;
+ if (max == NULL && min == NULL) {
+ PyErr_SetString(PyExc_ValueError, "One of max or min must be given.");
+ return NULL;
+ }
return _ARET(PyArray_Clip(self, min, max, out));
}
Modified: branches/numpy.scons/numpy/core/src/arraytypes.inc.src
===================================================================
--- branches/numpy.scons/numpy/core/src/arraytypes.inc.src 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/core/src/arraytypes.inc.src 2007-12-15 02:53:30 UTC (rev 4582)
@@ -2060,11 +2060,31 @@
@name at _fastclip(@type@ *in, intp ni, @type@ *min, @type@ *max, @type@ *out)
{
register npy_intp i;
- @type@ max_val, min_val;
+ @type@ max_val = 0, min_val = 0;
- max_val = *max;
- min_val = *min;
+ if (max != NULL)
+ max_val = *max;
+ if (min != NULL)
+ min_val = *min;
+ if (max == NULL) {
+ for (i = 0; i < ni; i++) {
+ if (in[i] < min_val) {
+ out[i] = min_val;
+ }
+ }
+ return;
+ }
+
+ if (min == NULL) {
+ for (i = 0; i < ni; i++) {
+ if (in[i] > max_val) {
+ out[i] = max_val;
+ }
+ }
+ return;
+ }
+
for (i = 0; i < ni; i++) {
if (in[i] < min_val) {
out[i] = min_val;
@@ -2086,10 +2106,33 @@
{
register npy_intp i;
@type@ max_val, min_val;
-
+
min_val = *min;
max_val = *max;
+ if (max != NULL)
+ max_val = *max;
+ if (min != NULL)
+ min_val = *min;
+
+ if (max == NULL) {
+ for (i = 0; i < ni; i++) {
+ if (PyArray_CLT(in[i],min_val)) {
+ out[i] = min_val;
+ }
+ }
+ return;
+ }
+
+ if (min == NULL) {
+ for (i = 0; i < ni; i++) {
+ if (PyArray_CGT(in[i], max_val)) {
+ out[i] = max_val;
+ }
+ }
+ return;
+ }
+
for (i = 0; i < ni; i++) {
if (PyArray_CLT(in[i], min_val)) {
out[i] = min_val;
Modified: branches/numpy.scons/numpy/core/src/multiarraymodule.c
===================================================================
--- branches/numpy.scons/numpy/core/src/multiarraymodule.c 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/core/src/multiarraymodule.c 2007-12-15 02:53:30 UTC (rev 4582)
@@ -1099,37 +1099,40 @@
}
static PyObject *
+_GenericBinaryOutFunction(PyArrayObject *m1, PyObject *m2, PyArrayObject *out,
+ PyObject *op)
+{
+ if (out == NULL)
+ return PyObject_CallFunction(op, "OO", m1, m2);
+ else
+ return PyObject_CallFunction(op, "OOO", m1, m2, out);
+}
+
+static PyObject *
_slow_array_clip(PyArrayObject *self, PyObject *min, PyObject *max, PyArrayObject *out)
{
- PyObject *selector=NULL, *newtup=NULL, *ret=NULL;
- PyObject *res1=NULL, *res2=NULL, *res3=NULL;
- PyObject *two;
+ PyObject *res1=NULL, *res2=NULL;
- two = PyInt_FromLong((long)2);
- res1 = PyArray_GenericBinaryFunction(self, max, n_ops.greater);
- res2 = PyArray_GenericBinaryFunction(self, min, n_ops.less);
- if ((res1 == NULL) || (res2 == NULL)) {
- Py_DECREF(two);
- Py_XDECREF(res1);
- Py_XDECREF(res2);
- return NULL;
+ if (max != NULL) {
+ res1 = _GenericBinaryOutFunction(self, max, out, n_ops.minimum);
+ if (res1 == NULL) return NULL;
}
- res3 = PyNumber_Multiply(two, res1);
- Py_DECREF(two);
- Py_DECREF(res1);
- if (res3 == NULL) return NULL;
+ else {
+ res1 = (PyObject *)self;
+ Py_INCREF(res1);
+ }
- selector = PyArray_EnsureAnyArray(PyNumber_Add(res2, res3));
- Py_DECREF(res2);
- Py_DECREF(res3);
- if (selector == NULL) return NULL;
-
- newtup = Py_BuildValue("(OOO)", (PyObject *)self, min, max);
- if (newtup == NULL) {Py_DECREF(selector); return NULL;}
- ret = PyArray_Choose((PyAO *)selector, newtup, out, NPY_RAISE);
- Py_DECREF(selector);
- Py_DECREF(newtup);
- return ret;
+ if (min != NULL) {
+ res2 = _GenericBinaryOutFunction((PyArrayObject *)res1,
+ min, out, n_ops.maximum);
+ if (res2 == NULL) {Py_XDECREF(res1); return NULL;}
+ }
+ else {
+ res2 = res1;
+ Py_INCREF(res2);
+ }
+ Py_DECREF(res1);
+ return res2;
}
/*MULTIARRAY_API
@@ -1144,22 +1147,38 @@
PyArrayObject *mina=NULL;
PyArrayObject *newout=NULL, *newin=NULL;
PyArray_Descr *indescr, *newdescr;
+ char *max_data, *min_data;
PyObject *zero;
+ if ((max == NULL) && (min == NULL)) {
+ PyErr_SetString(PyExc_ValueError, "array_clip: must set either max "\
+ "or min");
+ return NULL;
+ }
+
func = self->descr->f->fastclip;
- if (func == NULL || !PyArray_CheckAnyScalar(min) ||
- !PyArray_CheckAnyScalar(max))
+ if (func == NULL || (min != NULL && !PyArray_CheckAnyScalar(min)) ||
+ (max != NULL && !PyArray_CheckAnyScalar(max)))
return _slow_array_clip(self, min, max, out);
/* Use the fast scalar clip function */
/* First we need to figure out the correct type */
- indescr = PyArray_DescrFromObject(min, NULL);
- if (indescr == NULL) return NULL;
- newdescr = PyArray_DescrFromObject(max, indescr);
- Py_DECREF(indescr);
+ indescr = NULL;
+ if (min != NULL) {
+ indescr = PyArray_DescrFromObject(min, NULL);
+ if (indescr == NULL) return NULL;
+ }
+ if (max != NULL) {
+ newdescr = PyArray_DescrFromObject(max, indescr);
+ Py_XDECREF(indescr);
+ if (newdescr == NULL) return NULL;
+ }
+ else {
+ newdescr = indescr; /* Steal the reference */
+ }
+
- if (newdescr == NULL) return NULL;
/* Use the scalar descriptor only if it is of a bigger
KIND than the input array (and then find the
type that matches both).
@@ -1184,9 +1203,15 @@
}
/* Convert max to an array */
- maxa = (NPY_AO *)PyArray_FromAny(max, indescr, 0, 0,
- NPY_DEFAULT, NULL);
- if (maxa == NULL) return NULL;
+ if (max != NULL) {
+ maxa = (NPY_AO *)PyArray_FromAny(max, indescr, 0, 0,
+ NPY_DEFAULT, NULL);
+ if (maxa == NULL) return NULL;
+ }
+ else {
+ /* Side-effect of PyArray_FromAny */
+ Py_DECREF(indescr);
+ }
/* If we are unsigned, then make sure min is not <0 */
@@ -1197,31 +1222,33 @@
for other data-types in which case they
are interpreted as their modular counterparts.
*/
- if (PyArray_ISUNSIGNED(self)) {
- int cmp;
- zero = PyInt_FromLong(0);
- cmp = PyObject_RichCompareBool(min, zero, Py_LT);
- if (cmp == -1) { Py_DECREF(zero); goto fail;}
- if (cmp == 1) {
- min = zero;
- }
- else {
- Py_DECREF(zero);
- Py_INCREF(min);
- }
+ if (min != NULL) {
+ if (PyArray_ISUNSIGNED(self)) {
+ int cmp;
+ zero = PyInt_FromLong(0);
+ cmp = PyObject_RichCompareBool(min, zero, Py_LT);
+ if (cmp == -1) { Py_DECREF(zero); goto fail;}
+ if (cmp == 1) {
+ min = zero;
+ }
+ else {
+ Py_DECREF(zero);
+ Py_INCREF(min);
+ }
+ }
+ else {
+ Py_INCREF(min);
+ }
+
+ /* Convert min to an array */
+ Py_INCREF(indescr);
+ mina = (NPY_AO *)PyArray_FromAny(min, indescr, 0, 0,
+ NPY_DEFAULT, NULL);
+ Py_DECREF(min);
+ if (mina == NULL) goto fail;
}
- else {
- Py_INCREF(min);
- }
+
- /* Convert min to an array */
- Py_INCREF(indescr);
- mina = (NPY_AO *)PyArray_FromAny(min, indescr, 0, 0,
- NPY_DEFAULT, NULL);
- Py_DECREF(min);
- if (mina == NULL) goto fail;
-
-
/* Check to see if input is single-segment, aligned,
and in native byteorder */
if (PyArray_ISONESEGMENT(self) && PyArray_CHKFLAGS(self, ALIGNED) &&
@@ -1311,12 +1338,18 @@
/* Now we can call the fast-clip function */
- func(newin->data, PyArray_SIZE(newin), mina->data, maxa->data,
+ min_data = max_data = NULL;
+ if (mina != NULL)
+ min_data = mina->data;
+ if (maxa != NULL)
+ max_data = maxa->data;
+
+ func(newin->data, PyArray_SIZE(newin), min_data, max_data,
newout->data);
/* Clean up temporary variables */
- Py_DECREF(mina);
- Py_DECREF(maxa);
+ Py_XDECREF(mina);
+ Py_XDECREF(maxa);
Py_DECREF(newin);
/* Copy back into out if out was not already a nice array. */
Py_DECREF(newout);
Modified: branches/numpy.scons/numpy/core/src/umathmodule.c.src
===================================================================
--- branches/numpy.scons/numpy/core/src/umathmodule.c.src 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/core/src/umathmodule.c.src 2007-12-15 02:53:30 UTC (rev 4582)
@@ -414,7 +414,26 @@
#define isfinitef(x) (!(isinff((x)) || isnanf((x))))
#define isfinitel(x) (!(isinfl((x)) || isnanl((x))))
+float degreesf(float x) {
+ return x * (float)(180.0/M_PI);
+}
+double degrees(double x) {
+ return x * (180.0/M_PI);
+}
+longdouble degreesl(longdouble x) {
+ return x * (180.0L/M_PI);
+}
+float radiansf(float x) {
+ return x * (float)(M_PI/180.0);
+}
+double radians(double x) {
+ return x * (M_PI/180.0);
+}
+longdouble radiansl(longdouble x) {
+ return x * (M_PI/180.0L);
+}
+
/* First, the C functions that do the real work */
/* if C99 extensions not available then define dummy functions that use the
Modified: branches/numpy.scons/numpy/core/tests/test_multiarray.py
===================================================================
--- branches/numpy.scons/numpy/core/tests/test_multiarray.py 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/core/tests/test_multiarray.py 2007-12-15 02:53:30 UTC (rev 4582)
@@ -422,6 +422,15 @@
y = rec['x'].clip(-0.3,0.5)
self._check_range(y,-0.3,0.5)
+ def check_max_or_min(self):
+ val = N.array([0,1,2,3,4,5,6,7])
+ x = val.clip(3)
+ assert N.all(x >= 3)
+ x = val.clip(min=3)
+ assert N.all(x >= 3)
+ x = val.clip(max=4)
+ assert N.all(x <= 4)
+
class TestPutmask(ParametricTestCase):
def tst_basic(self,x,T,mask,val):
N.putmask(x,mask,val)
Modified: branches/numpy.scons/numpy/core/tests/test_umath.py
===================================================================
--- branches/numpy.scons/numpy/core/tests/test_umath.py 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/core/tests/test_umath.py 2007-12-15 02:53:30 UTC (rev 4582)
@@ -2,7 +2,7 @@
set_package_path()
from numpy.core.umath import minimum, maximum, exp
import numpy.core.umath as ncu
-from numpy import zeros, ndarray, array, choose
+from numpy import zeros, ndarray, array, choose, pi
restore_path()
class TestDivision(NumpyTestCase):
@@ -61,6 +61,16 @@
def check_floating_point(self):
assert_equal(ncu.FLOATING_POINT_SUPPORT, 1)
+def TestDegrees(NumpyTestCase):
+ def check_degrees(self):
+ assert_almost_equal(ncu.degrees(pi), 180.0)
+ assert_almost_equal(ncu.degrees(-0.5*pi), -90.0)
+
+def TestRadians(NumpyTestCase):
+ def check_radians(self):
+ assert_almost_equal(ncu.radians(180.0), pi)
+ assert_almost_equal(ncu.degrees(-90.0), -0.5*pi)
+
class TestSpecialMethods(NumpyTestCase):
def test_wrap(self):
class with_wrap(object):
Modified: branches/numpy.scons/numpy/distutils/command/build_scripts.py
===================================================================
--- branches/numpy.scons/numpy/distutils/command/build_scripts.py 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/distutils/command/build_scripts.py 2007-12-15 02:53:30 UTC (rev 4582)
@@ -37,6 +37,10 @@
return
self.scripts = self.generate_scripts(self.scripts)
+ # Now make sure that the distribution object has this list of scripts.
+ # setuptools' develop command requires that this be a list of filenames,
+ # not functions.
+ self.distribution.scripts = self.scripts
return old_build_scripts.run(self)
Copied: branches/numpy.scons/numpy/distutils/command/develop.py (from rev 4579, trunk/numpy/distutils/command/develop.py)
Modified: branches/numpy.scons/numpy/distutils/command/egg_info.py
===================================================================
--- branches/numpy.scons/numpy/distutils/command/egg_info.py 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/distutils/command/egg_info.py 2007-12-15 02:53:30 UTC (rev 4582)
@@ -2,5 +2,8 @@
class egg_info(_egg_info):
def run(self):
+ # We need to ensure that build_src has been executed in order to give
+ # setuptools' egg_info command real filenames instead of functions which
+ # generate files.
self.run_command("build_src")
_egg_info.run(self)
Modified: branches/numpy.scons/numpy/distutils/core.py
===================================================================
--- branches/numpy.scons/numpy/distutils/core.py 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/distutils/core.py 2007-12-15 02:53:30 UTC (rev 4582)
@@ -6,7 +6,7 @@
have_setuptools = True
from setuptools import setup as old_setup
# easy_install imports math, it may be picked up from cwd
- from setuptools.command import develop, easy_install
+ from setuptools.command import easy_install
try:
# very old versions of setuptools don't have this
from setuptools.command import bdist_egg
@@ -44,7 +44,9 @@
'bdist_rpm': bdist_rpm.bdist_rpm,
}
if have_setuptools:
- from numpy.distutils.command import egg_info
+ # Use our own versions of develop and egg_info to ensure that build_src is
+ # handled appropriately.
+ from numpy.distutils.command import develop, egg_info
numpy_cmdclass['bdist_egg'] = bdist_egg.bdist_egg
numpy_cmdclass['develop'] = develop.develop
numpy_cmdclass['easy_install'] = easy_install.easy_install
Modified: branches/numpy.scons/numpy/numarray/_capi.c
===================================================================
--- branches/numpy.scons/numpy/numarray/_capi.c 2007-12-15 02:43:35 UTC (rev 4581)
+++ branches/numpy.scons/numpy/numarray/_capi.c 2007-12-15 02:53:30 UTC (rev 4582)
@@ -4,7 +4,11 @@
#include "numpy/libnumarray.h"
#include <float.h>
-#if defined(__GLIBC__) || defined(__APPLE__) || defined(__MINGW32__)
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
+#include <sys/param.h>
+#endif
+
+#if defined(__GLIBC__) || defined(__APPLE__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
#include <fenv.h>
#elif defined(__CYGWIN__)
#include "numpy/fenv/fenv.h"
@@ -231,7 +235,7 @@
}
/* Likewise for Integer overflows */
-#if defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__)
+#if defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
static int int_overflow_error(Float64 value) { /* For x86_64 */
feraiseexcept(FE_OVERFLOW);
return (int) value;
@@ -2939,7 +2943,7 @@
return retstatus;
}
-#elif defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__)
+#elif defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
static int
NA_checkFPErrors(void)
More information about the Numpy-svn
mailing list