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

Fix possible overflow in Integer/LongGene mean method #791

Closed
jenetics opened this issue Aug 29, 2021 · 1 comment
Closed

Fix possible overflow in Integer/LongGene mean method #791

jenetics opened this issue Aug 29, 2021 · 1 comment
Assignees
Labels
Milestone

Comments

@jenetics
Copy link
Owner

The IntegerGene::mean and LongGene::mean method my be overflow on negative allele values.

Using (x&y)+((x^y)>>1) for calculating the average of two integer values.

http://aggregate.org/MAGIC/#Average%20of%20Integers

@jenetics jenetics added the bug label Aug 29, 2021
@jenetics jenetics added this to the v7.0.0 milestone Aug 29, 2021
@jenetics jenetics self-assigned this Aug 29, 2021
jenetics added a commit that referenced this issue Aug 29, 2021
@jenetics
Copy link
Owner Author

Merged into r7.0.0 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant