Skip to content

Commit

Permalink
Fix error when totalDensity is 0 in sumlogDens survey (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
acavelan authored Apr 7, 2022
1 parent 0f9773d commit 54581bd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion model/Host/WithinHost/CommonWithinHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,10 @@ bool CommonWithinHost::summarize( Host::Human& human )const{
// totalDensity > 0. Here we report the last calculated density.
if( diagnostics::monitoringDiagnostic().isPositive(human.rng(), totalDensity, std::numeric_limits<double>::quiet_NaN()) ){
mon::reportStatMHI( mon::MHR_PATENT_HOSTS, human, 1 );
mon::reportStatMHF( mon::MHF_LOG_DENSITY, human, log(totalDensity) );
if(totalDensity == 0.0)
mon::reportStatMHF( mon::MHF_LOG_DENSITY, human, 0.0);
else
mon::reportStatMHF( mon::MHF_LOG_DENSITY, human, log(totalDensity) );
return true; // patent
}
return false; // not patent
Expand Down

0 comments on commit 54581bd

Please sign in to comment.