pow?

Non-platform specific questions.

pow?

Postby Hblade » Thu Jun 09, 2011 5:42 pm

What does the pow command do, and how can I use it?
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: pow?

Postby jimmynewguy » Thu Jun 09, 2011 6:22 pm

pow: Returns base raised to the exp power (base exp). A domain error may occur if base is zero and exp is less than or equal to zero. It will also happen if base is negative and exp is not an integer. A range error is possible.

double pow(double base, double exp);


Code: Select all
pow(2, 2);

would be 2^2 (two to the power of two) and return a four.
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: pow?

Postby savvy » Thu Jun 09, 2011 6:23 pm

surely pow would be a number to the power of another number, if so this is useful.
so i = pow(5,2); would be 5 to the power of 2, so 5 x 5 which is 25. i think this is what it is.

EDIT: yes it is, its int 1 to the power of int 2
EDIT2: can use it to make calculators perhapse? can also be used if you want to get the square of a number... "pow(int,2);"
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: pow?

Postby Hblade » Thu Jun 09, 2011 6:50 pm

Thanks :D This will be exellent as a score multiplyer for the game :) thanks guys
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: pow?

Postby lcl » Thu Jun 09, 2011 9:42 pm

savvy wrote:can also be used if you want to get the square of a number... "pow(int,2);"

And sqrt(int); for square root. :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: pow?

Postby Hblade » Thu Jun 09, 2011 11:58 pm

thanks :)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest