Search code examples
objective-cxcodeprogramming-languages

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


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?


Solution

  • 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.