April 2013
Intermediate to advanced
1700 pages
92h 51m
English
This exception occurs when a division by zero is carried out for integral or decimal values and can be avoided by the application checking for a zero denominator upfront. Recall that floating-point types have infinity and Not a Number (NaN) values defined that will be used for the result of division-by-zero attempts.
The second and third lines here give rise to this exception, regardless of the use of a checked context; the same holds for the other integral and decimal data types:
int n = 1, d = 0;int div = n / d;int rem = n % d;
Read now
Unlock full access