diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-10-19 14:50:21 +0200 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-10-19 14:50:21 +0200 |
commit | 96ef52e560c359eb0182682b56725e05da07f064 (patch) | |
tree | a7b2fd12656979e74dfa8a15e169594c226b62ec /numpy/core | |
parent | d90c6e018318720fac72f363cd9f49c2af77b159 (diff) | |
download | numpy-96ef52e560c359eb0182682b56725e05da07f064.tar.gz |
BUG: don't set invalid flag in cbrt fallback
cbrt does not set the invalid flag on nan input as all inputs are valid.
Fix the fallback to behave the same.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/npymath/npy_math.c.src | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/core/src/npymath/npy_math.c.src b/numpy/core/src/npymath/npy_math.c.src index ba5c58fb4..b7f28bb39 100644 --- a/numpy/core/src/npymath/npy_math.c.src +++ b/numpy/core/src/npymath/npy_math.c.src @@ -491,7 +491,11 @@ double npy_log2(double x) #ifndef HAVE_CBRT@C@ @type@ npy_cbrt@c@(@type@ x) { - if (x < 0) { + /* don't set invalid flag */ + if (npy_isnan(x)) { + return NPY_NAN; + } + else if (x < 0) { return -npy_pow@c@(-x, 1. / 3.); } else { |