8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
On Python 2 & 3:
10 ** -9 == 10 ** int(-9) == pow(10, -9) == 10e-9
However, with newint, any negative power still returns a newint, which becomes 0:
from future.builtins import int as newint pow(10, newint(-9)) == 0
In such case, __pow__() should return a float.
__pow__()
The text was updated successfully, but these errors were encountered:
BTW, I've looked quickly at the code in future/types/newint.py and it seems that something similar to __mul__() works:
future/types/newint.py
__mul__()
def __rpow__(self, other): value = super(newint, self).__rpow__(other) if isint(value): return newint(value) elif value is NotImplemented: return other ** long(self) return value
Sorry, something went wrong.
Fix pow() with negative newint (issue #568)
a7dd2cb
Thanks @pieleric . I've added your fix in master.
master
No branches or pull requests
On Python 2 & 3:
However, with newint, any negative power still returns a newint, which becomes 0:
In such case,
__pow__()
should return a float.The text was updated successfully, but these errors were encountered: