Re: why use pow(x, 2)?
Re: why use pow(x, 2)?
- Subject: Re: why use pow(x, 2)?
- From: Sherm Pendley <email@hidden>
- Date: Mon, 2 Nov 2009 14:36:11 -0500
On Mon, Nov 2, 2009 at 2:25 PM, Ed Wynne <email@hidden> wrote:
>
> That said, the original question is a good one. Using x*x instead of
> pow(x,2) would be quite a bit faster
Are you certain of that? With loop unrolling and inlined functions, it
should result in identical code being produced by the compiler.
> so except for clarity reasons, there isn't a
> good reason to use pow() in that case.
Clarity should be the default, not the exception. Unless you've
profiled your code and found the use of pow() to be a significant
bottleneck, there's no good reason *not* to use it.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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