From a7a1ed2326c6bf0ea86b2f3126769beeae781f9e Mon Sep 17 00:00:00 2001 From: evomarc Date: Sat, 6 Jul 2002 05:23:18 +0000 Subject: [PATCH] I had left a flaw in teh Ctor (did not accept rates >1) --- eo/src/utils/eoHowMany.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/eo/src/utils/eoHowMany.h b/eo/src/utils/eoHowMany.h index d3580f47..917b41da 100644 --- a/eo/src/utils/eoHowMany.h +++ b/eo/src/utils/eoHowMany.h @@ -38,11 +38,11 @@ * allows one to modify the population size without touching anything else. * * There are 4 possible way to compute the return value from the argument: - * - an absolute POSITIVE integer --> return rate (regardless of popsize) - * - a POSITIVE rate -> return rate*popSize - * - an absolute NEGATIVE integer --> return popsize-rate - * - a NEGATIVE rate -> return (1-rate)*popSize - * Note that a negative rate should be unnecessary because a rate is + * - an absolute POSITIVE integer --> return it (regardless of popsize) + * - a POSITIVE rate --> return rate*popSize + * - an absolute NEGATIVE integer --> return popsize-rate (if positive) + * - a NEGATIVE rate in [-1,0] --> store and use 1-|rate| (positive) + * Note that a negative rate should be have been necessary because a rate is * relative, but it is there for consistency reasons - and because it * is needed in eoG3Replacement * @@ -77,9 +77,11 @@ public: if (_interpret_as_rate) { if (_rate<0) - rate = 1.0-rate; - if (rate > 1.0) - throw std::logic_error("rate>1 in eoHowMany!"); + { + rate = 1.0+_rate; + if (rate < 0) // was < -1 + throw std::logic_error("rate<-1 in eoHowMany!"); + } } else {