开发者

Learning Objective-C. Using Xcode 3.2.1. What is error: Program received signal: “EXC_ARITHMETIC”

I am learning Objective-C using Stephe开发者_运维百科n Kochan's excellent book "Programming in Objective-C 2.0". I am new also to Xcode. So far all my exercises have worked fine, but when I run program 7.6 FractionTest on page 153 I get the console message "Program received signal: "EXC_ARITHMETIC". The status shows that the program succeeded, but I don't see any output. Can anybody suggest what I might be doing wrong?


Check that if the denominator is zero (i.e. a divide-by-zero error).


EXC_ARITHMETIC (SIGFPE) is signaled when the CPU detects an invalid calculation. Some causes include divide by zero, integer overflow, etc., and integer divide by zero is most likely the reason since you're implementing a Fraction class.


EXC_ARITHMETIC is an exception in some sort of floating point operation. I don't have a copy of Programming in Objective-C 2.0, so I can't look up the problem. A code listing might be helpful.

If I had to take a stab in the dark, though, I'd say it might be a division-by-zero error.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜