diff options
Diffstat (limited to 'numpy/random/_common.pyx')
-rw-r--r-- | numpy/random/_common.pyx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/random/_common.pyx b/numpy/random/_common.pyx index 607034a38..7b6f69303 100644 --- a/numpy/random/_common.pyx +++ b/numpy/random/_common.pyx @@ -392,6 +392,9 @@ cdef int check_array_constraint(np.ndarray val, object name, constraint_type con elif cons == CONS_BOUNDED_GT_0_1: if not np.all(np.greater(val, 0)) or not np.all(np.less_equal(val, 1)): raise ValueError("{0} <= 0, {0} > 1 or {0} contains NaNs".format(name)) + elif cons == CONS_BOUNDED_LT_0_1: + if not np.all(np.greater_equal(val, 0)) or not np.all(np.less(val, 1)): + raise ValueError("{0} < 0, {0} >= 1 or {0} contains NaNs".format(name)) elif cons == CONS_GT_1: if not np.all(np.greater(val, 1)): raise ValueError("{0} <= 1 or {0} contains NaNs".format(name)) @@ -428,6 +431,9 @@ cdef int check_constraint(double val, object name, constraint_type cons) except elif cons == CONS_BOUNDED_GT_0_1: if not val >0 or not val <= 1: raise ValueError("{0} <= 0, {0} > 1 or {0} contains NaNs".format(name)) + elif cons == CONS_BOUNDED_LT_0_1: + if not (val >= 0) or not (val < 1): + raise ValueError("{0} < 0, {0} >= 1 or {0} is NaN".format(name)) elif cons == CONS_GT_1: if not (val > 1): raise ValueError("{0} <= 1 or {0} is NaN".format(name)) |