- 다른 뜻에 대해서는 전력 문서를 참조하십시오.
1 개요
- power
- pow
- **
- Returns base raised to the power of exp.
- test set
- power(2, -3) → 0.125
- power(3, 4) → 81
2 Excel
PHP
Copy
=POWER(2,-3)
// 0.125
=POWER(3,4)
// 81
3 Java

Java
Copy
public class MyClass {
public static void main(String args[]) {
System.out.println( Math.pow(2, -3) ); // 0.125
System.out.println( Math.pow(3, 0) ); // 1.0
System.out.println( Math.pow(3, 1) ); // 3.0
System.out.println( Math.pow(3, 2) ); // 9.0
System.out.println( Math.pow(3, 4) ); // 81.0
}
}
4 JavaScript
JavaScript
Copy
console.log( Math.pow(3,2) ); // 9
5 PHP
PHP
Copy
echo pow(2, -3);
echo pow(3, 4);
6 Python
Python
Copy
print(2**-3)
# 0.125
print(3**4)
# 81
Python
Copy
print(pow(2,-3))
# 0.125
print(pow(3,4))
# 81
7 Perl
Perl
Copy
print 2**-3;
# 0.125
print 3**4;
# 81
8 Ruby
Ruby
Copy
puts 2**-3
# 1/8
puts 3**4
# 81
9 같이 보기
로그인하시면 댓글을 쓸 수 있습니다.