{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaStats/Distributions.jl/issues/413","labels_url":"https://api.github.com/repos/JuliaStats/Distributions.jl/issues/413/labels{/name}","comments_url":"https://api.github.com/repos/JuliaStats/Distributions.jl/issues/413/comments","events_url":"https://api.github.com/repos/JuliaStats/Distributions.jl/issues/413/events","html_url":"https://github.com/JuliaStats/Distributions.jl/issues/413","id":104933524,"number":413,"title":"Categorical when length( p ) = 1_000_000","user":{"login":"matthieugomez","id":6223837,"avatar_url":"https://avatars.githubusercontent.com/u/6223837?v=3","gravatar_id":"","url":"https://api.github.com/users/matthieugomez","html_url":"https://github.com/matthieugomez","followers_url":"https://api.github.com/users/matthieugomez/followers","following_url":"https://api.github.com/users/matthieugomez/following{/other_user}","gists_url":"https://api.github.com/users/matthieugomez/gists{/gist_id}","starred_url":"https://api.github.com/users/matthieugomez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthieugomez/subscriptions","organizations_url":"https://api.github.com/users/matthieugomez/orgs","repos_url":"https://api.github.com/users/matthieugomez/repos","events_url":"https://api.github.com/users/matthieugomez/events{/privacy}","received_events_url":"https://api.github.com/users/matthieugomez/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaStats/Distributions.jl/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/JuliaStats/Distributions.jl/milestones/2","html_url":"https://github.com/JuliaStats/Distributions.jl/milestones/v0.9","labels_url":"https://api.github.com/repos/JuliaStats/Distributions.jl/milestones/2/labels","id":852137,"number":2,"title":"v0.9","description":"","creator":{"login":"lindahua","id":1900250,"avatar_url":"https://avatars.githubusercontent.com/u/1900250?v=3","gravatar_id":"","url":"https://api.github.com/users/lindahua","html_url":"https://github.com/lindahua","followers_url":"https://api.github.com/users/lindahua/followers","following_url":"https://api.github.com/users/lindahua/following{/other_user}","gists_url":"https://api.github.com/users/lindahua/gists{/gist_id}","starred_url":"https://api.github.com/users/lindahua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindahua/subscriptions","organizations_url":"https://api.github.com/users/lindahua/orgs","repos_url":"https://api.github.com/users/lindahua/repos","events_url":"https://api.github.com/users/lindahua/events{/privacy}","received_events_url":"https://api.github.com/users/lindahua/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":6,"state":"open","created_at":"2014-11-04T01:43:49Z","updated_at":"2015-09-05T00:42:12Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-09-04T17:27:25Z","updated_at":"2015-09-05T00:42:58Z","closed_at":null,"body":"```julia\r\np = fill(1.0, 1_000_000)\r\nscale!(p, 1/sum(p ))\r\nCategorical(p )\r\nERROR: ArgumentError: Categorical: the condition isprobvec(p) is not satisfied.\r\n```\r\nThe issue is that the sum of `p` never equals 1.0 at 1e-12.\r\nScaling twice does not improve the situation\r\n```julia\r\np = fill(1.0, 1_000_000)\r\nscale!(p, 1/sum(p ))\r\nscale!(p, 1/sum(p ))\r\nCategorical(p )\r\n```\r\n\r\nIs there a way to solve this issue?"},"comment":{"url":"https://api.github.com/repos/JuliaStats/Distributions.jl/issues/comments/137887936","html_url":"https://github.com/JuliaStats/Distributions.jl/issues/413#issuecomment-137887936","issue_url":"https://api.github.com/repos/JuliaStats/Distributions.jl/issues/413","id":137887936,"user":{"login":"lindahua","id":1900250,"avatar_url":"https://avatars.githubusercontent.com/u/1900250?v=3","gravatar_id":"","url":"https://api.github.com/users/lindahua","html_url":"https://github.com/lindahua","followers_url":"https://api.github.com/users/lindahua/followers","following_url":"https://api.github.com/users/lindahua/following{/other_user}","gists_url":"https://api.github.com/users/lindahua/gists{/gist_id}","starred_url":"https://api.github.com/users/lindahua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindahua/subscriptions","organizations_url":"https://api.github.com/users/lindahua/orgs","repos_url":"https://api.github.com/users/lindahua/repos","events_url":"https://api.github.com/users/lindahua/events{/privacy}","received_events_url":"https://api.github.com/users/lindahua/received_events","type":"User","site_admin":false},"created_at":"2015-09-05T00:42:58Z","updated_at":"2015-09-05T00:42:58Z","body":"This is due to the way that `sum(p)` is computed in `isprobvec`, which is not accurate enough. I am fixing it."}}