10000 [Long arithmetics] Element-wise involution fails · Issue #7405 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

[Long arithmetics] Element-wise involution fails #7405

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
ivanychev opened this issue Mar 10, 2016 · 2 comments
Closed

[Long arithmetics] Element-wise involution fails #7405

ivanychev opened this issue Mar 10, 2016 · 2 comments

Comments

@ivanychev
Copy link

Hey there. I've noticed a bug related to long arithmetic operations. Attached a screenshot below.

NumPy v.1.10.4
Python 3.5
OS X 10.11.4

2016-03-10 16 47 47

Custom involution and the operation that is performed to numpy.int64 types do well. Now look at the last two cells with elementwise involution. It appears to be that NumPy fails to compute the last value in the resulting array correctly.

@pv
Copy link
Member
pv commented Mar 10, 2016

The computation appears to be performed in floating point for some reason np.int64(15.**15.) == 437893890380859392.

@ewmoore
Copy link
Contributor
ewmoore commented Mar 10, 2016

For arrays, numpy calls the C pow function for integral types (ref) for scalars, it calls a power routine that uses integer multiplication (ref). Looks to me as though this is a long latent bug, as the technique used for scalar power (added in 2006) should probably be used for arrays as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0