Why was SIGFPE
used for integer arithmetic exceptions, such as division by zero, instead of creating a separate signal for integer arithmetic exceptions or naming the signal in the first place for arithmetic exceptions generally?
IEEE Std 1003.1 Standard defines SIGFPE as:
Erroneous arithmetic operation.
And doesn't really mention floating point operations. Reasoning behind this is not clearly stated, but here's my take on it.
x86 FPU can operate on both integer and floating point data at the same time with instructions such as FIDIV
, thus it would be unclear whether dividing floating poitn data by integer zero would generate a floating or and integer point exception.
Additionally, up to 80486 (which was released the same year as the ISO/ANSI C standard) x86 CPUs did not have floating point capabilities at all, floating point co-processor was a separate chip. Software floating point emulation could be used in place of the chip, but that used CPU's built in ALU (integer arithmetic-logical unit) which would throw integer exceptions.
© 2022 - 2024 — McMap. All rights reserved.