Fix DIV0 SEGV

.. in WPrime, and also don't bother trying to autosolve
   CP when W'bal is negative if W' is not setup
This commit is contained in:
Mark Liversedge
2014-01-26 12:10:13 +00:00
parent f10e24857d
commit 030fdc03b3
2 changed files with 4 additions and 1 deletions

View File

@@ -280,6 +280,9 @@ WPrime::PCP()
{
if (PCP_) return PCP_;
// check WPRIME is correct otherwise we will run forever!
if (WPRIME < 10000) return PCP_ = CP; // Wprime not set properly
int cp = CP;
do {

View File

@@ -56,7 +56,7 @@ class WPrime {
double maxMatch();
double minY, maxY;
double TAU, PCP_, CP, WPRIME, EXP;
double maxE() { return ((WPRIME - minY) / WPRIME) * 100.00f; }
double maxE() { return WPRIME ? (((WPRIME - minY) / WPRIME) * 100.00f) : 0; }
double PCP();