• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
working with NSDecimalNumber and NSNumber
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: working with NSDecimalNumber and NSNumber
      • From: Derrick Bass <email@hidden>
  • Prev by Date: RE: Help with NSArrayController, NSTableView and NSOpenPanel
  • Next by Date: Document-based apps/Alert sheet
  • Previous by thread: Re: Get the application name
  • Next by thread: Re: working with NSDecimalNumber and NSNumber
  • Index(es):
    • Date
    • Thread