-
Detecting +/-1.#J
Hi everyone,
How do I detect when the answer to a sum is infinity? I need to implement it into the following code:
Code:
if (Number == (Infinity))
MessageBox(hwnd, "Enter a number above zero.", "Error", MB_OK);
break;
It is a division sum.
Thanks.
-
See fpclassify or isinf ;-). The latter does just that.
-
Why not check if the denominator is zero before dividing?
-
Thanks.
I tried the check for 0, but it didn't seem to work for division sums.
Please could you show me how to use the isinf() operation?
Thanks.
-
Well, look up a reference for that - you should really have one. Or use an online one, there are plenty. Basically, it's very simple: if (isinf(num)) ...;