简体   繁体   English

除零误差

[英]divide-zero error

a divide expression in my code is " a / b ". 我的代码中的除法表达式是“a / b”。 when it is compiled to assemble, there is a trap-testing instruction(teq in MIPS assemble) following the normal divide instruction. 当它被编译为汇编时,在正常除法指令之后有一个陷阱测试指令(MIPS汇编中的teq)。
will all compiler add this kind of trap instruction behind the normal divide instruction? 所有编译器都会在正常除法指令后添加这种陷阱指令吗? I'm not familar with this situation. 我不熟悉这种情况。 Thanks very much. 非常感谢。

Most compilers won't specify the results when you do a divide by zero. 当你除以零时,大多数编译器都不会指定结果。 Since you didn't indicate what language or compiler you're using, it's impossible to be more specific than that. 由于您没有指出您正在使用的语言或编译器,因此不可能更具体。

PS Being able to read the assembly output from the compiler is a huge advantage in cases like this. PS在这种情况下,能够从编译器读取汇编输出是一个巨大的优势。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM