I'm having a problem identifying a floating point exception.
- by Peter Stewart
I'm using c++ in visual studio express to generate random expression trees for use in a genetic algorithm type of program.
Because they are random, the trees often generate (I'll call them exceptions, I'm not sure what they are)
Thanks to a suggestion by George, I turned the mask _MCW_EM on so that hardware interrupts are turned off. (the default)
So, the program runs uninterrupted, but some of the values returned are: -1.#INF, -1.#NAN, -1.#INV.
I don't know how to identify these so that I can throw an exeption:
if ( variable == -1.#INF) ??
DigitalRoss in this post seemed to have the solution, but as I understood it I couldn't make it work.
I've been looking all over the place for this simple bit of code, that I assumed would be used all
the time, but have had no luck.
thanks