Re: why use pow(x, 2)?
Re: why use pow(x, 2)?
- Subject: Re: why use pow(x, 2)?
- From: Luke the Hiesterman <email@hidden>
- Date: Mon, 2 Nov 2009 11:38:23 -0800
On Nov 2, 2009, at 11:36 AM, Sherm Pendley wrote:
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.
Completely agree. Never assume a performance problem until there is one.
Luke
_______________________________________________
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