Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting nth root of an integer




On May 27, 2007, at 10:18 AM, Charlton Wilbur wrote:

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.

Thanks Charlton

Next question regards floor(). if pow(x, 1.0/3) returns a value that can be represented as an integer (like 6.000000) executing floor (6.000000) returns 5.000000. Why isn't it returning 6? I looked at the various round functions but it doesn't look like you can tell them to round down.

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >getting nth root of an integer (From: Ken Tozier <email@hidden>)
 >Re: getting nth root of an integer (From: Charlton Wilbur <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.