• 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
Re: Math operations for NSNumber
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Math operations for NSNumber


  • Subject: Re: Math operations for NSNumber
  • From: Oleg Kibirev <email@hidden>
  • Date: Thu, 31 May 2007 17:23:08 -0700

Enjoy!

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ Classes/NSDecimalNumber_Class/index.html

Oleg


On May 31, 2007, at 4:31 PM, Ken Tozier wrote:

Hi

I know there are ways to extract C types from NSNumbers and numerous functions in Math.h for performing calculations but why doesn't NSNumber support calculations directly?

For example, say you have an NSArray of NSNumbers and you want to convert them in-place to their nth root. If NSNumber supported math functions, you could use NSArray's makeObjectsPerformSelector method to do it without having to loop through each, extract the value, get the root, and replace the number in the array. That and the support of arbitrary precision numbers (like gmp or arprec) could really simplify class definitions, calculations etc.

Apple keeps the internal implementation details to themselves so I'm sure they could come up with a minimal overhead way to do this and developers would benefit by never having to write another conversion function to perform a calculation on a class property or array of numbers.

Anyone think of a good reason not to do this?

- Ken
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
40oracle.com


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Math operations for NSNumber
      • From: Buddy Kurz <email@hidden>
References: 
 >Math operations for NSNumber (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: Math operations for NSNumber
  • Next by Date: Re: NSObject -poseAs:
  • Previous by thread: Re: Math operations for NSNumber
  • Next by thread: Re: Math operations for NSNumber
  • Index(es):
    • Date
    • Thread