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

BugFix: Logging would divide by 0 if calculating standard deviation… #763

Merged
merged 1 commit into from
Jan 19, 2022

Conversation

Robadob
Copy link
Member

@Robadob Robadob commented Jan 18, 2022

…of variable for empty agent population.

Noticed it whilst investigating adding standard deviation to HostAPI.

@Robadob Robadob added the bug label Jan 18, 2022
@Robadob Robadob self-assigned this Jan 18, 2022
@Robadob Robadob added this to the v2.0.0-alpha.N milestone Jan 18, 2022
Copy link
Member

@ptheywood ptheywood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this want to be static_cast<T>(0)? though it probably doesn't matter because casting 0 between any numeric type should be fine.

@Robadob
Copy link
Member Author

Robadob commented Jan 18, 2022

Function returns type util::Any, I just copied the normal return statement rather than looking to deeply into it.

Logging has to store values of a bunch of types inside a map, hence the use of Any. The only possible problem i forsee here would be the Any storing 0 as type int, but it being read back as type double.

@Robadob Robadob force-pushed the bugfix_logging_standarddev_nan branch from 8aa3b56 to 4635147 Compare January 18, 2022 14:41
@Robadob
Copy link
Member Author

Robadob commented Jan 18, 2022

Small change, tweaked it to util::Any(0.0), so its a double inside an Any.

@mondus mondus merged commit eef1a36 into master Jan 19, 2022
@mondus mondus deleted the bugfix_logging_standarddev_nan branch January 19, 2022 15:05
@Robadob Robadob modified the milestones: v2.0.0-alpha.N, v2.0.0-alpha.3 Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants