How do I add NSDecimalNumbers?
Posted
by Terry B
on Stack Overflow
See other posts from Stack Overflow
or by Terry B
Published on 2010-03-15T18:16:52Z
Indexed on
2010/03/15
18:19 UTC
Read the original article
Hit count: 270
OK this may be the dumb question of the day, but supposing I have a class with :
NSDecimalNumber *numOne = [NSDecimalNumber numberWithFloat:1.0];
NSDecimalNumber *numTwo = [NSDecimalNumber numberWithFloat:2.0];
NSDecimalNumber *numThree = [NSDecimalNumber numberWithFloat:3.0];
Why can't I have a function that adds those numbers:
- (NSDecimalNumber *)addThem {
return (self.numOne + self.numTwo + self.numThree);
}
I apologize in advance for being an idiot, and thanks!
© Stack Overflow or respective owner