Math.pow | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Math.pow

Hey guys, please help me with the Math.pow class double p = Math.pow(2, 3); // 8.0 I don‘t understand to calculate this. Thank you!

17th Jan 2019, 9:41 PM
Frank Seltmann
Frank Seltmann - avatar
7 Answers
+ 4
Yes, exactly
17th Jan 2019, 10:30 PM
Michal
Michal - avatar
+ 3
Math.pow(a,b); a - the base. b - the exponent. Returns:the value a^b
17th Jan 2019, 10:11 PM
Michal
Michal - avatar
+ 3
2^3 it is actually equals 2*2*2
17th Jan 2019, 10:19 PM
Michal
Michal - avatar
+ 3
Frank Seltmann you're welcome 😊. Happy learning.
17th Jan 2019, 10:46 PM
Michal
Michal - avatar
+ 2
ahh, now I understand so it means double p = Math.pow(2, 4); // 16.0 2*2=4 4*2=8 8*2=16 correct?
17th Jan 2019, 10:24 PM
Frank Seltmann
Frank Seltmann - avatar
+ 2
wonderful, thanks a lot for your support Michal!
17th Jan 2019, 10:45 PM
Frank Seltmann
Frank Seltmann - avatar
+ 1
the value a^b or the value of a*a*a?
17th Jan 2019, 10:17 PM
Frank Seltmann
Frank Seltmann - avatar