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

[BUG] The Probability() function can create probabilities < 0 and > 1 #348

Closed
davidcerny opened this issue Apr 23, 2023 · 1 comment
Closed

Comments

@davidcerny
Copy link
Contributor

Describe the bug
The Probability() function can cast any real number to type Probability, not just those that are >= 0 and <= 1.

To Reproduce

a <- -13/12
type(a)
b := Probability(a)
type(b)

Expected behavior
RevBayes should throw an error message stating that the value is outside of the valid range for probabilities. It is not clear to me why this doesn't happen, since both the type constructor and the Real::convertTo() function check for this condition.

Screenshots
N/A

Computer info
RevBayes v1.2.1 on Red Hat Enterprise Linux 8.4 and macOS 12.6.5.

@davidcerny
Copy link
Contributor Author

Solved by PR #410.

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