{"action":"created","issue":{"url":"https://api.github.com/repos/numpy/numpy/issues/5438","labels_url":"https://api.github.com/repos/numpy/numpy/issues/5438/labels{/name}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/5438/comments","events_url":"https://api.github.com/repos/numpy/numpy/issues/5438/events","html_url":"https://github.com/numpy/numpy/pull/5438","id":53978873,"number":5438,"title":"BUG: linspace handling of denormals, fixes #5437","user":{"login":"jaimefrio","id":3343990,"avatar_url":"https://avatars.githubusercontent.com/u/3343990?v=3","gravatar_id":"","url":"https://api.github.com/users/jaimefrio","html_url":"https://github.com/jaimefrio","followers_url":"https://api.github.com/users/jaimefrio/followers","following_url":"https://api.github.com/users/jaimefrio/following{/other_user}","gists_url":"https://api.github.com/users/jaimefrio/gists{/gist_id}","starred_url":"https://api.github.com/users/jaimefrio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaimefrio/subscriptions","organizations_url":"https://api.github.com/users/jaimefrio/orgs","repos_url":"https://api.github.com/users/jaimefrio/repos","events_url":"https://api.github.com/users/jaimefrio/events{/privacy}","received_events_url":"https://api.github.com/users/jaimefrio/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-01-11T02:09:13Z","updated_at":"2015-01-13T03:15:44Z","closed_at":"2015-01-12T23:32:02Z","pull_request":{"url":"https://api.github.com/repos/numpy/numpy/pulls/5438","html_url":"https://github.com/numpy/numpy/pull/5438","diff_url":"https://github.com/numpy/numpy/pull/5438.diff","patch_url":"https://github.com/numpy/numpy/pull/5438.patch"},"body":"The following code now runs about 50% slower:\r\n\r\n```\r\n# current master\r\nIn [2]: %timeit np.linspace(0, 1, 1000000)\r\n100 loops, best of 3: 15.8 ms per loop\r\n\r\n# this PR\r\nIn [2]: %timeit np.linspace(0, 1, 1000000)\r\n10 loops, best of 3: 21.7 ms per loop\r\n```\r\n\r\nBut denormals are correctly handled:\r\n\r\n```\r\n# Current master\r\nIn [2]: np.linspace(0, np.finfo(np.double).tiny*np.finfo(np.double).resolution,\r\n   ...:             10, endpoint=False)\r\nOut[2]: array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.])\r\n\r\n# This PR\r\nIn [2]: np.linspace(0, np.finfo(np.double).tiny*np.finfo(np.double).resolution,\r\n   ...:             10, endpoint=False)\r\nOut[2]:\r\narray([  0.00000000e+000,   0.00000000e+000,   4.94065646e-324,\r\n         9.88131292e-324,   9.88131292e-324,   9.88131292e-324,\r\n         1.48219694e-323,   1.97626258e-323,   1.97626258e-323,\r\n         1.97626258e-323])\r\n```\r\n\r\nWe could get that speed back by branching on the size of `step = (stop - start) / num`, not sure it is worth the extra complication."},"comment":{"url":"https://api.github.com/repos/numpy/numpy/issues/comments/69689526","html_url":"https://github.com/numpy/numpy/pull/5438#issuecomment-69689526","issue_url":"https://api.github.com/repos/numpy/numpy/issues/5438","id":69689526,"user":{"login":"jaimefrio","id":3343990,"avatar_url":"https://avatars.githubusercontent.com/u/3343990?v=3","gravatar_id":"","url":"https://api.github.com/users/jaimefrio","html_url":"https://github.com/jaimefrio","followers_url":"https://api.github.com/users/jaimefrio/followers","following_url":"https://api.github.com/users/jaimefrio/following{/other_user}","gists_url":"https://api.github.com/users/jaimefrio/gists{/gist_id}","starred_url":"https://api.github.com/users/jaimefrio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaimefrio/subscriptions","organizations_url":"https://api.github.com/users/jaimefrio/orgs","repos_url":"https://api.github.com/users/jaimefrio/repos","events_url":"https://api.github.com/users/jaimefrio/events{/privacy}","received_events_url":"https://api.github.com/users/jaimefrio/received_events","type":"User","site_admin":false},"created_at":"2015-01-13T03:15:44Z","updated_at":"2015-01-13T03:15:44Z","body":"Let's continue the discussion in #5446 "}}