diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2016-11-05 12:29:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-05 12:29:51 -0400 |
commit | 2272c32d90026cc07af9c8bca3c2a33feb1e788a (patch) | |
tree | 6840d837c0283569960ac01f61c4d94c11a0ca52 /doc | |
parent | 62046aa1f3b4666519cbd7d5481dae836e34bbd3 (diff) | |
parent | 7e31e32f093887d5fd99f719a06bc2b5ed7dc9c8 (diff) | |
download | numpy-2272c32d90026cc07af9c8bca3c2a33feb1e788a.tar.gz |
Merge pull request #8231 from charris/integer-to-neg-integer-power
ENH: Refactor numpy ** operators for numpy scalar integer powers
Diffstat (limited to 'doc')
-rw-r--r-- | doc/release/1.12.0-notes.rst | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/doc/release/1.12.0-notes.rst b/doc/release/1.12.0-notes.rst index 473511c3d..e752c1ef1 100644 --- a/doc/release/1.12.0-notes.rst +++ b/doc/release/1.12.0-notes.rst @@ -76,15 +76,29 @@ DeprecationWarning to error ``power`` and ``**`` raise errors for integer to negative integer powers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The previous behavior was +The previous behavior depended on whether numpy scalar integers or numpy +integer arrays were involved. + +For arrays + +* Zero to negative integer powers returned least integral value. +* Both 1, -1 to negative integer powers returned correct values. +* The remaining integers returned zero when raised to negative integer powers. + +For scalars + +* Zero to negative integer powers returned least integral value. +* Both 1, -1 to negative integer powers returned correct values. +* The remaining integers sometimes returned zero, sometimes the + correct float depending on the integer type combination. + +All of these cases now raise a ``ValueError`` except for those integer +combinations whose common type is float, for instance uint64 and int8. It was +felt that a simple rule was the best way to go rather than have special +exceptions for the integer units. If you need negative powers, use an inexact +type. -* zero to negative integer powers returned least integral value. -* 1, -1 to negative integer powers returned correct values -* all remaining integers returned zero when raised to negative integer powers. -All of these cases now raise a ``ValueError``. It was felt that a simple rule -was the best way to go rather than have special exceptions for the units. If -you need negative powers, use an inexact type. Relaxed stride checking is the default ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |