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

max readDouble value? #287

Open
JorySchossau opened this issue Nov 9, 2018 · 1 comment
Open

max readDouble value? #287

JorySchossau opened this issue Nov 9, 2018 · 1 comment

Comments

@JorySchossau
Copy link
Member

JorySchossau commented Nov 9, 2018

From a collaborator:

"One technicality I found that is a (very) minor bug is the following:
This is from readDouble:
return ((value / genome->alphabetSize) * (valueMax - valueMin)) + valueMin;
Since the value can be between 0 and 255, in order to get probabilities including 0 and 1, one should divide by 255 instead of 256 (the genome->alphabetSize), if I am not mistaken. As is, the maximum possible probability is 255/256. Be careful that if you do it 1:256 divided by 256 you never get the 0. So it really should be 0:255 divided by 255. If I'm not totally mistaken. "

@cliff-bohm
Copy link
Collaborator

This issue is pretty interesting actually. On the one hand, we could have the 'current' behavior where the max value that readDouble can return is (upper bound - (1/aphabetSize)) which would make it act like typical random number generators for doubles (i.e. range is 0 to less than 1). But this is not intuitive. So the code is being changed so that if the site value is alphabetSize - 1 (i.e. the max allowed value) then the max value will be returned. This has no effect one readDouble when the type is double. Also, writeDouble for non-doubles needed to be updated so that (as much as possible) writing a value in a given range and reading the same site with the same range would result in the same value (accepting, rounding errors of course)

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

2 participants