working with NSDecimalNumber and NSNumber
working with NSDecimalNumber and NSNumber
- Subject: working with NSDecimalNumber and NSNumber
- From: "email@hidden" <email@hidden>
- Date: Fri, 23 Jun 2006 17:34:32 +0200
Hi list
I was wondering what was the most efficient way to process
calculations between an NSNumber and an NSDecimalNumber
should I use :
NSNumber *myNormalNumber;
NSDecimalNumber *myDecimalNumber;
[...]
myDecimalNumber = [myDecimalNumber decimalNumberByMultiplyingBy:
[NSDecimalNumber decimalNumberWithString:[myNormalNumber stringValue]]];
or
myDecimalNumber = [myDecimalNumber decimalNumberByMultiplyingBy:
[NSDecimalNumber decimalNumberWithDecimal:[myNormalNumber
decimalValue]]];
(documentation says that decimalValue's value returned isn’t
guaranteed to be exact for float and double values)
or should I use parent methods From NSNumber like numberWithFloat: ?
I use NSDecimalNumber for money related values so my calculations
need to be as precise as possible ...
Regards
Pierre Oleo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden