From 4c76c8959273e32d3e25cfae63cb88834b909fb0 Mon Sep 17 00:00:00 2001 From: okoenig Date: Fri, 1 Dec 2006 08:42:54 +0000 Subject: [PATCH] Replaced float vars with double to avoid conversion warnings on VS 8.0 --- eo/src/utils/eoRNG.cpp | 2 +- eo/src/utils/eoRNG.h | 6 +++--- eo/src/utils/selectors.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eo/src/utils/eoRNG.cpp b/eo/src/utils/eoRNG.cpp index 17159bfc..8989024d 100644 --- a/eo/src/utils/eoRNG.cpp +++ b/eo/src/utils/eoRNG.cpp @@ -9,6 +9,6 @@ namespace eo { /// The Global random number generator. - eoRng rng(time(0)); + eoRng rng( (uint32_t) time(0) ); } diff --git a/eo/src/utils/eoRNG.h b/eo/src/utils/eoRNG.h index 088c7d7a..c9e1067f 100644 --- a/eo/src/utils/eoRNG.h +++ b/eo/src/utils/eoRNG.h @@ -180,7 +180,7 @@ public : flip() tosses a biased coin such that flip(x/100.0) will returns true x% of the time */ - bool flip(float bias=0.5) + bool flip(double bias=0.5) { return uniform() < bias; } @@ -363,7 +363,7 @@ private: // for normal distribution bool cached; - float cacheValue; + double cacheValue; const int N; @@ -471,7 +471,7 @@ inline double eoRng::normal(void) return cacheValue; } - float rSquare, factor, var1, var2; + double rSquare, factor, var1, var2; do { diff --git a/eo/src/utils/selectors.h b/eo/src/utils/selectors.h index 43d28a0f..e2ab6cf6 100644 --- a/eo/src/utils/selectors.h +++ b/eo/src/utils/selectors.h @@ -143,7 +143,7 @@ template It roulette_wheel(It _begin, It _end, double total, eoRng& _gen = rng) { - float roulette = _gen.uniform(total); + double roulette = _gen.uniform(total); if (roulette == 0.0) // covers the case where total==0.0 return _begin + _gen.random(_end - _begin); // uniform choice @@ -161,7 +161,7 @@ It roulette_wheel(It _begin, It _end, double total, eoRng& _gen = rng) template const EOT& roulette_wheel(const eoPop& _pop, double total, eoRng& _gen = rng) { - float roulette = _gen.uniform(total); + double roulette = _gen.uniform(total); if (roulette == 0.0) // covers the case where total==0.0 return _pop[_gen.random(_pop.size())]; // uniform choice