diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2022-11-15 13:31:47 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-15 13:31:47 -0600 |
commit | 3ca02ce5b1a4ec2412cad839d42452a4200a5270 (patch) | |
tree | f1777b8defeb5c33bafadf89da770ab14358c0b3 /numpy/random/_common.pyx | |
parent | 8cededdf4eeebd4f1985bd74c11fbf44f367937f (diff) | |
parent | e88592e94a0b7de726bc1e3dbf3abf637be47273 (diff) | |
download | numpy-3ca02ce5b1a4ec2412cad839d42452a4200a5270.tar.gz |
Merge pull request #22594 from charris/backport-22450
BUG: Fix boundschecking for `random.logseries`
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)) |