Skip to content

(-2) ** 0.5 yields NaN #1986

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

Closed
lilydjwg opened this issue Jul 7, 2020 · 2 comments · Fixed by #2030
Closed

(-2) ** 0.5 yields NaN #1986

lilydjwg opened this issue Jul 7, 2020 · 2 comments · Fixed by #2030
Labels
C-compat A discrepancy between RustPython and CPython

Comments

@lilydjwg
Copy link

lilydjwg commented Jul 7, 2020

Feature

non-integer power of negative numbers.

Python Documentation

@lilydjwg lilydjwg added the C-compat A discrepancy between RustPython and CPython label Jul 7, 2020
@youknowone
Copy link
Member

CPython:

>>> float.__rpow__(0.5, -2)
(8.659560562354934e-17+1.4142135623730951j)

RustPython:

>>>>> float.__rpow__(0.5, -2)
NaN

@minoring
Copy link
Contributor

I am handling this issue :)

minoring added a commit to minoring/RustPython that referenced this issue Jul 27, 2020
Result:

RustPython gives
`float.__rpow__(0.5, -2)
(0.00000000000000008659560562354934+1.4142135623730951j)`

CPython 3.85 gives
`>>> float.__rpow__(0.5, -2)
(8.659560562354934e-17+1.4142135623730951j)`
minoring added a commit to minoring/RustPython that referenced this issue Jul 27, 2020
Result:

RustPython gives
`float.__rpow__(0.5, -2)
(0.00000000000000008659560562354934+1.4142135623730951j)`

CPython 3.85 gives
`>>> float.__rpow__(0.5, -2)
(8.659560562354934e-17+1.4142135623730951j)`
minoring added a commit to minoring/RustPython that referenced this issue Jul 27, 2020
Result:

RustPython gives
`float.__rpow__(0.5, -2)
(0.00000000000000008659560562354934+1.4142135623730951j)`

CPython 3.85 gives
`>>> float.__rpow__(0.5, -2)
(8.659560562354934e-17+1.4142135623730951j)`
minoring added a commit to minoring/RustPython that referenced this issue Jul 28, 2020
Result:

RustPython gives
`float.__rpow__(0.5, -2)
(0.00000000000000008659560562354934+1.4142135623730951j)`

CPython 3.85 gives
`>>> float.__rpow__(0.5, -2)
(8.659560562354934e-17+1.4142135623730951j)`
youknowone pushed a commit that referenced this issue Jul 29, 2020
Fix #1986 which (-2) ** 0.5 yields NaN.

Result:

RustPython gives
`float.__rpow__(0.5, -2)
(0.00000000000000008659560562354934+1.4142135623730951j)`

CPython 3.85 gives
`>>> float.__rpow__(0.5, -2)
(8.659560562354934e-17+1.4142135623730951j)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-compat A discrepancy between RustPython and CPython
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants