Skip to content

BUG: integers to a negative integer powers should error. - #8127

Merged
charris merged 2 commits into
numpy:masterfrom
charris:integer-to-negative-power
Oct 20, 2016
Merged

charris merged 2 commits into
numpy:masterfrom
charris:integer-to-negative-power

Conversation

@charris

@charris charris commented Oct 7, 2016 •

Copy link
Copy Markdown
Member

Rebase of #7599 with changes.

This is a change in behavior. 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.

Fixes gh-7510.

@charris charris added this to the 1.12.0 release milestone Oct 7, 2016
@charris charris changed the title Rebase, BUG: integer 0 to a negative power should error. BUG: integers to a negative integer powers should error. Oct 8, 2016
Comment thread doc/release/1.12.0-notes.rst Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some typos: "returne[d]" and "ot".

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.
@charris
charris force-pushed the integer-to-negative-power branch from 98416df to f4f8a1c Compare October 20, 2016 19:45
@charris
charris merged commit 88a66d8 into numpy:master Oct 20, 2016
@charris
charris deleted the integer-to-negative-power branch October 20, 2016 21:08
jorisvandenbossche added a commit to jorisvandenbossche/pandas that referenced this pull request Oct 26, 2016
jorisvandenbossche added a commit to jorisvandenbossche/pandas that referenced this pull request Oct 26, 2016
jreback added a commit to jreback/pandas that referenced this pull request Oct 26, 2016
jreback added a commit to pandas-dev/pandas that referenced this pull request Oct 26, 2016
…wers

xref numpy/numpy#8127    closes #14489

Author: Jeff Reback <[email protected]>

Closes #14498 from jreback/compat and squashes the following commits:

882872e [Jeff Reback] COMPAT/TST: fix test for range testing of negative integers to neg powers
jorisvandenbossche pushed a commit to jorisvandenbossche/pandas that referenced this pull request Nov 2, 2016
… negative integers to neg powers

xref numpy/numpy#8127    closes pandas-dev#14489

Author: Jeff Reback <[email protected]>

Closes pandas-dev#14498 from jreback/compat and squashes the following commits:

882872e [Jeff Reback] COMPAT/TST: fix test for range testing of negative integers to neg powers

(cherry picked from commit 050bf60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants