HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Pow(x, y) question

08-09-2009, 09:10 AM#1
Flame_Phoenix
Until today I had a peaceful life, knowing that Pow(x, y) would (should?) be slower than doing (x*x*....) y times.

But now, this post makes me wonder:
http://www.wc3c.net/showpost.php?p=1097989&postcount=44

So, can anyone confirm that Pow is faster? Should it now be used on multiplications?

Special thanks to BlinkBoy for the benchmark.
08-09-2009, 09:33 AM#2
Captain Griffen
We've always known the breakeven point between the two is around 3 (that benchmark is within the margin of error, I'd say). Pow(x, y)'s speed is pretty much O(1), while x*x*x... is O(n). Therefore saying x*x.. is faster would be silly.
08-09-2009, 01:34 PM#3
chobibo
So is it better to use Pow for exponents exceeding 3?
08-09-2009, 03:26 PM#4
Tot
Yep
08-09-2009, 06:02 PM#5
Flame_Phoenix
Damn ... this is something new for me ... bookmarked and thx for confirmation =D