为什么零结果并整数除法的浮点异常? [英] Why does integer division by zero result in a floating point exception?
问题描述
在C程序的结果异常终止与错误讯息零部浮点异常(核心转储)
。这是不足为奇的浮点除法,但为什么它说,零这个时候整数除法发生?难道整数除法实际使用FPU引擎盖下?
(这是所有在Linux下x86的,顺便说一句。)
请问整数除法实际使用FPU引擎盖下?
块引用>没有,只是Linux的产生在这种情况下SIGFPE太(它是一个传统的名字其使用现在已经扩展)。事实上,单一Unix规格定义SIGFPE 为错误的算术运算
Division by zero in a C program results in abnormal termination with the error message
Floating point exception (core dumped)
. This is unsurprising for floating point division, but why does it say this when integer division by zero occurs? Does integer division actually use the FPU under the hood?(This is all on Linux under x86, by the way.)
解决方案Does integer division actually use the FPU under the hood?
No, Linux just generates SIGFPE in this case too (it's a legacy name whose usage has now been extended). Indeed, the Single Unix Specification defines SIGFPE as "Erroneous arithmetic operation".
这篇关于为什么零结果并整数除法的浮点异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!