Skip to content

Commit

Permalink
Bugfix: make empty deme parasite load zero not nan
Browse files Browse the repository at this point in the history
  • Loading branch information
mmore500 committed Nov 24, 2023
1 parent adb619f commit 6e517a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion avida-core/source/main/cDeme.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ class cDeme

int GetNumParasites() const;
double GetParasiteLoad() const {
return static_cast<double>(GetNumParasites()) / GetOrgCount();
const auto org_count = GetOrgCount();
if (org_count == 0) return 0.0;
else return static_cast<double>(GetNumParasites()) / GetOrgCount();
}

void UpdateParasiteMemoryScore(const double decay) {
Expand Down

0 comments on commit 6e517a9

Please sign in to comment.