pow()
설명
숫자 거듭제곱 값 계산. pow() 는 숫자를 분수 제곱하는 데 쓸 수 있다. 이것은 곡선의 지수 매핑을 생성할 때 쓸모 있다.
문법
pow(base, exponent)
매개변수
- base: 숫자 (float)
- exponent: base 를 거듭 곱할 횟수 (float)
반환값
- 거듭제곱 결과. (double)
예제 코드
void setup() {
Serial.begin(9600);
int x = 2;
int y = 3;
double z = pow(x, y);
Serial.print(x);
Serial.print(" raised to the power of ");
Serial.print(y);
Serial.print(" is ");
Serial.println(z);
}
void loop() {}
The result in Serial Monitor:
COM6
2 raised to the power of 3 is 8.00
Autoscroll
Clear output
9600 baud
Newline
코드 라이브러리에서 (fscale) 함수를 보세요.
더보기
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |
Disclosure: Some links in this section are Amazon affiliate links. If you make a purchase through these links, we may earn a commission at no extra cost to you.
Additionally, some links direct to products from our own brand, DIYables.
Additionally, some links direct to products from our own brand, DIYables.