[Numpy-svn] [numpy/numpy] f23676: BUG: integer 0 to a negative power should error.

GitHub noreply at github.com
Thu Oct 20 17:08:47 EDT 2016


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: f236760314d5c32bf4d9398f1cffc3c68be5eaea
      https://github.com/numpy/numpy/commit/f236760314d5c32bf4d9398f1cffc3c68be5eaea
  Author: Eric Moore <ewm at redtetrahedron.org>
  Date:   2016-10-07 (Fri, 07 Oct 2016)

  Changed paths:
    M numpy/core/src/umath/loops.c.src
    M numpy/core/tests/test_regression.py
    M numpy/core/tests/test_umath.py

  Log Message:
  -----------
  BUG: integer 0 to a negative power should error.

Fixes gh-7510.


  Commit: f4f8a1c01c701e92c8b290b58682da8dfbdaac67
      https://github.com/numpy/numpy/commit/f4f8a1c01c701e92c8b290b58682da8dfbdaac67
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2016-10-20 (Thu, 20 Oct 2016)

  Changed paths:
    M doc/release/1.12.0-notes.rst
    M numpy/core/src/umath/loops.c.src
    M numpy/core/tests/test_umath.py

  Log Message:
  -----------
  ENH: Power ufunc raises error for integer to negative integer powers.

This is a change in behaviour. Previously

* 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.


  Commit: 88a66d8d0464caf57f40cf85a24156042e7ff0d7
      https://github.com/numpy/numpy/commit/88a66d8d0464caf57f40cf85a24156042e7ff0d7
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2016-10-20 (Thu, 20 Oct 2016)

  Changed paths:
    M doc/release/1.12.0-notes.rst
    M numpy/core/src/umath/loops.c.src
    M numpy/core/tests/test_regression.py
    M numpy/core/tests/test_umath.py

  Log Message:
  -----------
  Merge pull request #8127 from charris/integer-to-negative-power

BUG: integers to a negative integer powers should error.


Compare: https://github.com/numpy/numpy/compare/e6122fd2aabc...88a66d8d0464


More information about the Numpy-svn mailing list