{"action":"created","issue":{"url":"https://api.github.com/repos/numpy/numpy/issues/9876","repository_url":"https://api.github.com/repos/numpy/numpy","labels_url":"https://api.github.com/repos/numpy/numpy/issues/9876/labels{/name}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/9876/comments","events_url":"https://api.github.com/repos/numpy/numpy/issues/9876/events","html_url":"https://github.com/numpy/numpy/issues/9876","id":266012964,"number":9876,"title":"sum gives wrong result for structured arrays","user":{"login":"akhilman","id":180812,"avatar_url":"https://avatars3.githubusercontent.com/u/180812?v=4","gravatar_id":"","url":"https://api.github.com/users/akhilman","html_url":"https://github.com/akhilman","followers_url":"https://api.github.com/users/akhilman/followers","following_url":"https://api.github.com/users/akhilman/following{/other_user}","gists_url":"https://api.github.com/users/akhilman/gists{/gist_id}","starred_url":"https://api.github.com/users/akhilman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akhilman/subscriptions","organizations_url":"https://api.github.com/users/akhilman/orgs","repos_url":"https://api.github.com/users/akhilman/repos","events_url":"https://api.github.com/users/akhilman/events{/privacy}","received_events_url":"https://api.github.com/users/akhilman/received_events","type":"User","site_admin":false},"labels":[{"id":6359214,"url":"https://api.github.com/repos/numpy/numpy/labels/00%20-%20Bug","name":"00 - Bug","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2017-10-17T06:58:38Z","updated_at":"2017-10-18T04:07:46Z","closed_at":null,"author_association":"NONE","body":"```python\r\n>>> a = np.zeros(1000, dtype=[('a', np.int64), ('b', np.float64), ('c', np.int32)])\r\n>>> a['b'].sum()\r\n0.0\r\n>>> a['a'] = np.arange(1, 1+len(a))\r\n>>> a['b'].sum()  # expecting 0 here\r\n1.7060846163323196e-309\r\n>>> \r\n```\r\nall works fine if I change last one field to int64\r\n```python\r\n>>> a = np.zeros(1000, dtype=[('a', np.int64), ('b', np.float64), ('c', np.int64)])\r\n>>> a['a'] = np.arange(1, 1+len(a))\r\n>>> a['b'].sum()\r\n0.0\r\n```\r\n\r\n```python\r\n>>> np.__version__\r\n'1.13.3'\r\n>>> sys.version\r\n'3.6.1 (default, May 30 2017, 02:29:58) \\n[GCC 6.3.0 20170516]'\r\n```\r\nDebian stable 32bit"},"comment":{"url":"https://api.github.com/repos/numpy/numpy/issues/comments/337454971","html_url":"https://github.com/numpy/numpy/issues/9876#issuecomment-337454971","issue_url":"https://api.github.com/repos/numpy/numpy/issues/9876","id":337454971,"user":{"login":"ahaldane","id":9040124,"avatar_url":"https://avatars1.githubusercontent.com/u/9040124?v=4","gravatar_id":"","url":"https://api.github.com/users/ahaldane","html_url":"https://github.com/ahaldane","followers_url":"https://api.github.com/users/ahaldane/followers","following_url":"https://api.github.com/users/ahaldane/following{/other_user}","gists_url":"https://api.github.com/users/ahaldane/gists{/gist_id}","starred_url":"https://api.github.com/users/ahaldane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahaldane/subscriptions","organizations_url":"https://api.github.com/users/ahaldane/orgs","repos_url":"https://api.github.com/users/ahaldane/repos","events_url":"https://api.github.com/users/ahaldane/events{/privacy}","received_events_url":"https://api.github.com/users/ahaldane/received_events","type":"User","site_admin":false},"created_at":"2017-10-18T04:07:46Z","updated_at":"2017-10-18T04:07:46Z","author_association":"MEMBER","body":"Well, the stride calculation is going wrong when `DOUBLE_add` assumes the data is aligned [here](https://github.com/numpy/numpy/blob/95ffd706890c472a1c06e4e07cbe4f259407216e/numpy/core/src/umath/loops.c.src#L1711), but presumably the bug is actually earlier somewhere where we should be checking for alignment and making an aligned copy if needed. \r\n\r\nCurrently [this](https://github.com/numpy/numpy/blob/95ffd706890c472a1c06e4e07cbe4f259407216e/numpy/core/src/umath/reduction.c#L550) line looks suspicious to me."}}
{"actor":{"display_login":"ahaldane"}}