Divide-by-zero not throwing an exception but giving NaN or Infinity

I’m dividing by zero using Assign dblResult = 0/0 or Assign dblResult = 1/0 but instead of throwing an exception it gives dblResult.ToString = “NaN” for 0/0 or dblResult.ToString = “Infinity” for 1/0. In both cases dblResult.IsNumeric returns True. dblResult is a System.Double variable.

This doesn’t match anything I can find in the documentation or forum, so why doesn’t it throw an exception and where are “Infinity” and “NaN” documented?

Hi @ian.gaffron,
Can you check below URL if not solved your case just update us.

Hi,

As Double type can has NaN or Infinity, there is no Zero divide exception.
If you need to check it, the following will help you.

image

Double.IsInfinity(dblVar) OrElse Double.IsNaN(dblVar)

Regards,

Thank you!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.