Learning Objective-C. Using Xcode 3.2.1. What is the error: Program signal: "EXC_ARITHMETIC"

I am learning Objective-C with Steven Cochan's excellent book, "Programming in Objective-C 2.0." I am new to Xcode too. So far, all my exercises have worked fine, but when I run the 7.6 FractionTest program on page 153, I get the console message “Program received signal:“ EXC_ARITHMETIC. ”The status indicates that the program has succeeded, but I can’t see any way out. Can anyone -Any guess what I can do wrong?

+3
source share
2 answers

Make sure that if the denominator is zero (i.e., division by zero error).


EXC_ARITHMETIC (SIGFPE) is signaled when the CPU detects an incorrect calculation. Some reasons include division by zero, integer overflow, etc., and integer division by zero is most likely the reason, since you are implementing a fraction class.

+8
source

EXC_ARITHMETIC is an exception in some kind of floating point operation. I do not have a copy of the programming in Objective-C 2.0, so I can not find the problem. A list of codes may be helpful.

If I had to hit in the dark, I would say that it could be a division by zero error.

0
source

Source: https://habr.com/ru/post/1742679/


All Articles