Why does a%b produce SIGFPE when b is zero?

后端 未结 2 1210
温柔的废话
温柔的废话 2020-11-29 08:08

Today I was tracking down a floating point exception in some code I had just written. It took a little while to find because it was actually caused by taking an integer mod

2条回答
  •  囚心锁ツ
    2020-11-29 08:48

    Take a look at this page.

    Relevant part for your question:

    SIG is a common prefix for signal names; FPE is an acronym for floating-point exception. Although SIGFPE does not necessarily involve floating-point arithmetic, there is no way to change its name without breaking backward compatibility.

提交回复
热议问题