Replaced float vars with double to avoid conversion warnings on VS 8.0

This commit is contained in:
okoenig 2006-12-01 08:42:54 +00:00
commit 4c76c89592
3 changed files with 6 additions and 6 deletions

View file

@ -9,6 +9,6 @@
namespace eo namespace eo
{ {
/// The Global random number generator. /// The Global random number generator.
eoRng rng(time(0)); eoRng rng( (uint32_t) time(0) );
} }

View file

@ -180,7 +180,7 @@ public :
flip() tosses a biased coin such that flip(x/100.0) will flip() tosses a biased coin such that flip(x/100.0) will
returns true x% of the time returns true x% of the time
*/ */
bool flip(float bias=0.5) bool flip(double bias=0.5)
{ {
return uniform() < bias; return uniform() < bias;
} }
@ -363,7 +363,7 @@ private:
// for normal distribution // for normal distribution
bool cached; bool cached;
float cacheValue; double cacheValue;
const int N; const int N;
@ -471,7 +471,7 @@ inline double eoRng::normal(void)
return cacheValue; return cacheValue;
} }
float rSquare, factor, var1, var2; double rSquare, factor, var1, var2;
do do
{ {

View file

@ -143,7 +143,7 @@ template <class It>
It roulette_wheel(It _begin, It _end, double total, eoRng& _gen = rng) 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 if (roulette == 0.0) // covers the case where total==0.0
return _begin + _gen.random(_end - _begin); // uniform choice 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 <class EOT> template <class EOT>
const EOT& roulette_wheel(const eoPop<EOT>& _pop, double total, eoRng& _gen = rng) const EOT& roulette_wheel(const eoPop<EOT>& _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 if (roulette == 0.0) // covers the case where total==0.0
return _pop[_gen.random(_pop.size())]; // uniform choice return _pop[_gen.random(_pop.size())]; // uniform choice