summaryrefslogtreecommitdiff
path: root/numpy/random/mtrand
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/random/mtrand')
-rw-r--r--numpy/random/mtrand/distributions.c4
-rw-r--r--numpy/random/mtrand/initarray.c1
-rw-r--r--numpy/random/mtrand/numpy.pxd2
3 files changed, 4 insertions, 3 deletions
diff --git a/numpy/random/mtrand/distributions.c b/numpy/random/mtrand/distributions.c
index 2b1f5e7a9..1b410db57 100644
--- a/numpy/random/mtrand/distributions.c
+++ b/numpy/random/mtrand/distributions.c
@@ -447,6 +447,10 @@ long rk_binomial(rk_state *state, long n, double p)
{
double q;
+ if ((n == 0LL) || (p == 0.0f)) {
+ return 0;
+ }
+
if (p <= 0.5)
{
if (p*n <= 30.0)
diff --git a/numpy/random/mtrand/initarray.c b/numpy/random/mtrand/initarray.c
index 21f1dc05a..beff78510 100644
--- a/numpy/random/mtrand/initarray.c
+++ b/numpy/random/mtrand/initarray.c
@@ -71,7 +71,6 @@
* http://www.math.keio.ac.jp/matumoto/emt.html
* email: matumoto@math.keio.ac.jp
*/
-#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#include "initarray.h"
diff --git a/numpy/random/mtrand/numpy.pxd b/numpy/random/mtrand/numpy.pxd
index 1b4fe6c10..e146054b1 100644
--- a/numpy/random/mtrand/numpy.pxd
+++ b/numpy/random/mtrand/numpy.pxd
@@ -3,8 +3,6 @@
# :Author: Travis Oliphant
from cpython.exc cimport PyErr_Print
-cdef extern from "numpy/npy_no_deprecated_api.h": pass
-
cdef extern from "numpy/arrayobject.h":
cdef enum NPY_TYPES: