floating point division

What if you have to do some floating point division:

If I understand correctly, if I divide by a non-zero number, no matter how small it is, I won't get an exception for dividing by zero?

However, the result might be big enough to cause a problem? Will it ever cause an outright exception? Or would you just get a result like an inf or Nan, but not an exception?

Would it be safe to assume if the result is not inf or Nan that the result is valid and safe to continue using?

thanks
Last edited on
It could lead to precision errors too, but if you did not get infinity or NaN, then result does correlates with reality.

Will it ever cause an outright exception? Or would you just get a result like an inf or Nan, but not an exception?
Depends on machine, program settings.
Division by zero usually doesn't crash the programs the way integers do.

http://en.cppreference.com/w/cpp/types/numeric_limits/traps
Topic archived. No new replies allowed.