tan()
설명
각(라디안)의 탄젠트 계산. 결과는 음의 무한과 무한 사이.
문법
tan(rad)
매개변수
- rad: 라디안 각 (float).
반환값
- 각의 탄젠트 (double).
예제 코드
void setup() {
Serial.begin(9600);
for (int angle = 0; angle <= 180; angle += 15) {
float angle_rad = angle * M_PI / 180;
float tan_result = tan(angle_rad);
Serial.print("tan(");
Serial.print(angle);
Serial.print("°) = ");
Serial.println(tan_result);
}
}
void loop() {
}
The result in Serial Monitor:
COM6
tan(0°) = 0.00
tan(15°) = 0.27
tan(30°) = 0.58
tan(45°) = 1.00
tan(60°) = 1.73
tan(75°) = 3.73
tan(90°) = -22845570.00
tan(105°) = -3.73
tan(120°) = -1.73
tan(135°) = -1.00
tan(150°) = -0.58
tan(165°) = -0.27
tan(180°) = 0.00
Autoscroll
Clear output
9600 baud
Newline
※ 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.