Floating Point Exception... catchable?

Oct 3, 2011 at 6:58am
Hello all. So I'd like to know if an FPE can be caught with try/catch blocks, and if so how?
Oct 3, 2011 at 11:26am
Of course you can catch FPE. Just declare the catch argument appropriately:
1
2
3
4
5
6
7
8
9
try{
...
throw static_cast<float>(x);
...
}
catch (float x)
{
...
}


You can do this without cast if you use double
Topic archived. No new replies allowed.