Wc3C.net Pow(x, y) question
 Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar

 08-09-2009, 09:10 AM #1 Flame_Phoenix retired coder | real ilfe     Join Date: Mar 2007 Posts: 2,208 Submissions (10) Pow(x, y) question 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. __________________ Check out my tutorials at: 1-Creating a Hero Tavern 2-Complete Icon Tutorial - ALL about Icons 3-Making a spell in vJass - Practice Session 1 Check out all my current spells at here Finally, check my project: Castle vs Castle Flame Edition
08-09-2009, 09:33 AM   #2
Captain Griffen

Content Director

Join Date: Sep 2003
Posts: 5,375

Submissions (2)

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.
__________________
Quote:
 Originally Posted by Earth-Fury Griffen is correct, you are not.
Quote:
 [13:32] hmm.. stil i want to have some unused women

 08-09-2009, 01:34 PM #3 chobibo 100% Genuine Retard!     Join Date: Jan 2007 Posts: 797 So is it better to use Pow for exponents exceeding 3? __________________ Where's mah sig?
 08-09-2009, 03:26 PM #4 Tot †6†     Join Date: Oct 2008 Posts: 841 Yep __________________ Current Projects: Masters Of WarCraft: Some mixture of AoS and RPGTerrain: 100%, Coding: 75%, Heroes: 0%, Items: 0%, Creeps: 0%, Upgrades: 0% hunting emos____________________________________ scheiss kack dreck sausacksau bundeswehr
 08-09-2009, 06:02 PM #5 Flame_Phoenix retired coder | real ilfe     Join Date: Mar 2007 Posts: 2,208 Submissions (10) Damn ... this is something new for me ... bookmarked and thx for confirmation =D __________________ Check out my tutorials at: 1-Creating a Hero Tavern 2-Complete Icon Tutorial - ALL about Icons 3-Making a spell in vJass - Practice Session 1 Check out all my current spells at here Finally, check my project: Castle vs Castle Flame Edition