|
|
|
|
|
by seanmcdirmid
2875 days ago
|
|
Typically, divide by zero throws for integers because they can’t express NaN, which can instead be returned for floating point. In any case, integers can’t express special values, so you get exceptions instead. And this is actually defined at the processor level (for x86 among others), the trap is free (well, a sunk cost), why not take it? Zero is not a very good NaN. |
|