How do I detect when the answer to a sum is infinity? I need to implement it into the following code:
It is a division sum.
if (Number == (Infinity))
MessageBox(hwnd, "Enter a number above zero.", "Error", MB_OK);
See fpclassify or isinf ;-). The latter does just that.
Why not check if the denominator is zero before dividing?
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?
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)) ...;