I am learning Objective-C using Stephen 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?
views:
184answers:
2
+1
Q:
Learning Objective-C. Using Xcode 3.2.1. What is error: Program received signal: “EXC_ARITHMETIC”.
+3
A:
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.
KennyTM
2010-04-25 16:06:41
Dear KennyTMOnce again, thanks for your help. I hadn't seen that I had left an important line out of my code, resulting ultimately in a divide by zero error. The program works well now.Kind RegardsDerry
Derry
2010-04-26 06:18:03
A:
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.
mipadi
2010-04-25 16:08:24
Dear mipadiOnce again, thanks for your help. I hadn't seen that I had left an important line out of my code, resulting ultimately in a divide by zero error. The program works well now.Kind RegardsDerry
Derry
2010-04-26 06:19:17