My iPhone has a line of code that looks like this:
Repeat Decimal 2 = abs (NewLocation.coordinate.longitude - degrees); I am trying to make sure that the value of decimal 2 is always positive. However, the decimal 2 is currently -82.
Can anyone explain this? I'm not doing anything else the value of decimal 2
Thank you.
You NSDecimalNumber < P>, you can use the underlying function of the NSDecimalNumber class to compare the number to zero, then multiply -1 as an appropriate example: - (NSDecimalNumber *) abs: (NSDecimalNumber *) num {if compare myNumber: [NSDecimalNumber zero]] == NSOrderedAscending) {// the number is negative. 1 by NSDC command number multiplied by negative number = [NSDCMNMR decimal decimal numberCommentation: 1 exponent: 0 is negative: yes]; Return [Number Decimal Decimal Numberality: Negative On]; } And {return number; }} In this case, there is no loss of accuracy
Comments
Post a Comment