{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/16841","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/16841/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/16841/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/16841/events","html_url":"https://github.com/JuliaLang/julia/pull/16841","id":159383630,"number":16841,"title":"ndigits: check for invalid bases (fix #16766)","user":{"login":"rfourquet","id":8462914,"avatar_url":"https://avatars.githubusercontent.com/u/8462914?v=3","gravatar_id":"","url":"https://api.github.com/users/rfourquet","html_url":"https://github.com/rfourquet","followers_url":"https://api.github.com/users/rfourquet/followers","following_url":"https://api.github.com/users/rfourquet/following{/other_user}","gists_url":"https://api.github.com/users/rfourquet/gists{/gist_id}","starred_url":"https://api.github.com/users/rfourquet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfourquet/subscriptions","organizations_url":"https://api.github.com/users/rfourquet/orgs","repos_url":"https://api.github.com/users/rfourquet/repos","events_url":"https://api.github.com/users/rfourquet/events{/privacy}","received_events_url":"https://api.github.com/users/rfourquet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-06-09T11:16:29Z","updated_at":"2016-06-09T20:02:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/16841","html_url":"https://github.com/JuliaLang/julia/pull/16841","diff_url":"https://github.com/JuliaLang/julia/pull/16841.diff","patch_url":"https://github.com/JuliaLang/julia/pull/16841.patch"},"body":"I made `ndigits(x, b)` with `-1 <= b <= 1` an error in all cases, even if `x == 0`, as I thought it was more consistent. There were a lot of dispatch methods `ndigits[0z][nb](x, [b])`, so it's possible I messed up one of the paths.\r\nAlso I removed the `ndigits(::BigInt, [b])` method, to handle the base check in only one place, the drawback being that we then compare `x == 0` instead of the probably more efficient `x.size == 0`.\r\nHopefully this is overall a simplification of the `ndigits` logic."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/225009465","html_url":"https://github.com/JuliaLang/julia/pull/16841#issuecomment-225009465","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/16841","id":225009465,"user":{"login":"StefanKarpinski","id":153596,"avatar_url":"https://avatars.githubusercontent.com/u/153596?v=3","gravatar_id":"","url":"https://api.github.com/users/StefanKarpinski","html_url":"https://github.com/StefanKarpinski","followers_url":"https://api.github.com/users/StefanKarpinski/followers","following_url":"https://api.github.com/users/StefanKarpinski/following{/other_user}","gists_url":"https://api.github.com/users/StefanKarpinski/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanKarpinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanKarpinski/subscriptions","organizations_url":"https://api.github.com/users/StefanKarpinski/orgs","repos_url":"https://api.github.com/users/StefanKarpinski/repos","events_url":"https://api.github.com/users/StefanKarpinski/events{/privacy}","received_events_url":"https://api.github.com/users/StefanKarpinski/received_events","type":"User","site_admin":false},"created_at":"2016-06-09T20:02:18Z","updated_at":"2016-06-09T20:02:18Z","body":"If keyword arguments didn't introduce too much overhead still, we could make the signature\r\n\r\n```jl\r\ndigits(n; base::Integer=10, min::Integer=1)\r\n```\r\n\r\nThat way you could do `digits(n, min=0)` instead of `digits0z`."}}
{"actor":{"display_login":"StefanKarpinski"}}