tan()

Description

Calcule la tangente d'un angle (en radians). Le résultat sera entre moins l'infini et l'infini.

Syntaxe

tan(rad);

Paramètres

  • rad: l'angle en radians (float)

Valeurs Renvoyées

  • La tangente de l'angle (double)

Exemple

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
Send
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 Show timestamp
Clear output
9600 baud  
Newline  

Voir Également

ARDUINO BUY RECOMMENDATION

Arduino UNO R3
Arduino Starter Kit
Please note: These are affiliate links. If you buy the components through these links, We may get a commission at no extra cost to you. We appreciate it.

※ OUR MESSAGES

  • We are AVAILABLE for HIRE. See how to hire us to build your project
  • Any suggestion, correction, and translation? please email us at ArduinoGetStarted@gmail.com, We appreciate it
  • We mainly keep improving the references in English. See English version of this page for the latest update.