• 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 question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Math question


  • Subject: Re: Math question
  • From: "John C. Randolph" <email@hidden>
  • Date: Sat, 1 Sep 2001 16:27:28 -0700

On Saturday, September 1, 2001, at 02:34 PM, email@hidden wrote:

Hello all. i have a question about math in Cocoa. how do i do higher level math? obviously i can do the basics */+-% without problem. but what about doing things like raising a number to a power?

fooSquared = foo^2;

For other math functions in the C standard library, open a terminal window and type "man math".

i've looked over the foundation functions like NSDecimalPower. i understand everything about how to use them except how to generate the NSDecimal i need. NSDecimal isn't a class, it's structure. how to i set it to a number? i thought about using NSDecimalNumber (a class) and using its function to return an NSDecimal for use in the NSDecimalPower function, but still i can't figure out how to set it up first. there must be something really easy i'm overlooking. thanks for your help in advance.

NSDecimalNumber is for use when you need arbitrary precision and very fine control of things like rounding behaviour.

-jcr

"This is not a book to be tossed aside lightly. Rather, it should be hurled with great force." -Dorothy Parker


  • Follow-Ups:
    • Re: Math question
      • From: Peter Ammon <email@hidden>
    • Re: Math question
      • From: Vince DeMarco <email@hidden>
References: 
 >Math question (From: email@hidden)

  • Prev by Date: Re: NSWindow order back and stay, dammit!
  • Next by Date: Re: NSWindow order back and stay, dammit!
  • Previous by thread: Math question
  • Next by thread: Re: Math question
  • Index(es):
    • Date
    • Thread