Floating Point Exception... catchable?
Hello all. So I'd like to know if an FPE can be caught with try/catch blocks, and if so how?
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.