diff options
author | Kevin Sheppard <kevin.sheppard@gmail.com> | 2021-02-26 23:01:15 +0000 |
---|---|---|
committer | Kevin Sheppard <kevin.sheppard@gmail.com> | 2021-02-26 23:01:15 +0000 |
commit | e900be2bf367d2a90af922e56c27aadcd0581bdf (patch) | |
tree | 4bec298c1c43ed26feb2efb1aa4d2d846f12cdb1 /numpy | |
parent | 2ee92e20151f5c7b0c5602a550b91b9171898210 (diff) | |
download | numpy-e900be2bf367d2a90af922e56c27aadcd0581bdf.tar.gz |
Address comments
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/random/_generator.pyx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index b0bfd860c..cd950b3fa 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -3758,15 +3758,15 @@ cdef class Generator: if kahan_sum(pix, d-1) > (1.0 + 1e-12): # When floating, but not float dtype, and close, improve the error # 1.0001 works for float16 and float32 - if (isinstance(pvals, np.ndarray) and - pvals.dtype != float and - np.issubdtype(pvals.dtype, np.floating) and - pvals.sum() < 1.0001): - msg = ("sum(pvals[:-1].astype(np.float64)) > 1.0. pvals are " - "cast to 64-bit floating point values prior to " - "checking the constraint. Changes in precision when " - "casting may produce violations even if " - "pvals[:-1].sum() <= 1.") + if (isinstance(pvals, np.ndarray) + and np.issubdtype(pvals.dtype, np.floating) + and pvals.dtype != float + and pvals.sum() < 1.0001): + msg = ("sum(pvals[:-1].astype(np.float64)) > 1.0. The pvals " + "array is cast to 64-bit floating point prior to " + "checking the sum. Precision changes when casting may " + "cause problems even if the sum of the original pvals " + "is valid.") else: msg = "sum(pvals[:-1]) > 1.0" raise ValueError(msg) |