Skip to content
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

Incorrect result: adding two numbers from discrete() where the sum is more than the int size specified in the discrete() #67

Open
lisaoakley opened this issue Mar 13, 2024 · 0 comments

Comments

@lisaoakley
Copy link

lisaoakley commented Mar 13, 2024

Minimal example:

let r0 = discrete(0.9,0.1) in
let r1 = discrete(0.9,0.1) in
r0 + r1

Expected:

[{"Joint Distribution":[["Value","Probability"],["0","0.81"],["1","0.18000000000000005"],["2","0.010000000000000004"]]}]

Or a type error of some kind telling me this is not possible.

Actual:

{"Joint Distribution":[["Value","Probability"],["0","0.82000000000000006"],["1","0.18000000000000005"]]}]

Workaround:

let r0 = discrete(0.9,0.1,0) in
let r1 = discrete(0.9,0.1,0) in
r0 + r1

Output:

[{"Joint Distribution":[["Value","Probability"],["0","0.81"],["1","0.18000000000000005"],["2","0.010000000000000004"],["3","0"]]}]

Note that this output has an entry for '3' but this should always have probability zero. In other words, the workaround results in excess entries in the distribution.

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

1 participant