Thanks for the response. I know experts-exchange is not the place for a flame war, but I find Objective C a total pain in the ass. XCode on the mac is nice for code completion, but why does everything take some many characters? Why is a routine called decimalNumberByMultiplying
And trying to use color [UIColor redColor]? Why does color appear twice in that snippet? Don't we already know that red is likely to be a color? since we are using a method on the color class?
These libraries appear to have been designed by idiots (or perhaps just Californians).
Main Topics
Browse All Topics





by: AGoodKeenManPosted on 2009-10-13 at 16:20:40ID: 25565848
I think the short answer is no. You could use [NSDecimalNumber zero] and substract 1, but its not very neat.
It really depends on what you are doing with the number, as I understand it NSDecimalNumber is for base 10 arithmetic (I can't think of an example). If you just want to store the value in a collection eg. NSArray, then just use NSNumber.
I read this from the documentation:
You might consider the C interface if you dont need to treat decimal numbers as objectsthat is, if you dont need to store them in an object-oriented collection like an instance of NSArray or NSDictionary. You might also consider the C interface if you need maximum efficiency. The C interface is faster and uses less memory than the NSDecimalNumber class.
If you need mutability, you can combine the two interfaces. Use functions from the C interface and convert their results to instances of NSDecimalNumber.