Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Oct 20, 2016

Conversation

charris
Copy link
Member

@charris charris commented Oct 7, 2016

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

* zero to negative integer powers returned least integral value.
* 1, -1 to negative integer powers returned correct values
* all remaining integers returne zero when raised ot negative integer powers.
Copy link
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 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 <jeff@reback.net>

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 <jeff@reback.net>

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.

None yet

3 participants