objective c - How to prevent division by zero when the denominator is a CGFloat? -
I have a number that is a CGFLOT and I want to divide it by a few numbers. How can I ensure that the separator is not equal to zero or NaN? The following example examines the separator before partition to ensure that it is not 0 or NaN
CGFLot dividend = 5f; CGFloat divisor = 3.f; If (! (Adnan (divisor)) separator == 0.f)) {CGFloat quotient = dividend / separator; }
Comments
Post a Comment