• 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: getting nth root of an integer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting nth root of an integer


  • Subject: Re: getting nth root of an integer
  • From: Charlton Wilbur <email@hidden>
  • Date: Sun, 27 May 2007 10:18:44 -0400


On May 27, 2007, at 10:08 AM, Ken Tozier wrote:

I need to get the nth root of integers and find that pow(x, 1/p) doesn't work where p = power. I looked in the math.h file but didn't see anything that jumped out at me other than sqrt. Is there a function to get nth roots?

Yes, and you found it.

If the variable p is an integer, however, by C's integer division rules 1/p will be 0 whenever p != 1. pow(x, 1.0/p) will probably do what you want.

Charlton


-- Charlton Wilbur 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: getting nth root of an integer
      • From: Ken Tozier <email@hidden>
References: 
 >getting nth root of an integer (From: Ken Tozier <email@hidden>)

  • Prev by Date: getting nth root of an integer
  • Next by Date: Re: getting nth root of an integer
  • Previous by thread: getting nth root of an integer
  • Next by thread: Re: getting nth root of an integer
  • Index(es):
    • Date
    • Thread