[galib] Error initializing floats
Fábio Roberto Teodoro
fr.teodoro at gmail.com
Sun May 25 16:38:35 EDT 2008
Doing some experiments with the GARealGenome, i stated that if the lower bound
of gene is -inf (-std::numeric_limits<float>::infinity()) the GARandomFloat()
always return -nan. I think that, for example: if i set the allele as [-inf,
+inf] it should return any float.
Follow is the excerpt from my debug session:
GARandomFloat (low=-inf, high=inf) at /usr/include/ga/garandom.h:106
106 float val=high-low; val*=_GA_RND(); return val+low;
(gdb) print val
$47 = inf
(gdb) print val+low
$48 = -nan(0x8000000000000)
Now I can't think of a solution for this, or maybe this can be done in another
way in GAlib.
If this is really a bug I'll try to fix it and post a patch to this list.
Any sugestion is wellcome.
TIA
More information about the galib
mailing list