How do I use try...catch to catch floating point errors?

Posted by Peter Stewart on Stack Overflow See other posts from Stack Overflow or by Peter Stewart
Published on 2010-05-05T00:22:02Z Indexed on 2010/05/05 0:28 UTC
Read the original article Hit count: 553

Filed under:
|
|

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: divide by zero, overflow, underflow as well as

returning "inf" and other strings. I can write handlers for the strings, but the literature left me

baffled about the others. If I understand it correctly, I have to set some flags first? Advice

and/or a pointer to some literature would be appreciated.

© Stack Overflow or respective owner

Related posts about c++

Related posts about error-handling