How do you get the int and modulo (mod) of division with an NSDecimalNumber
问题 I am confused by NSDecimalNumber and its "behaviors". I have an NSDecimalNumber that represents a dollar value, say $37.50. I'd like to find out how many times say 5.0 goes into that number and then know what's left over. I can get the straight division and get 7.50 but I want 7 mod 2.50. I could convert to an integer but need to save the "cents" so wondering if there's some tricks in the framework? 回答1: Using Peter Hoseys example, but with iOS code: NSDecimalNumber *dividend =