Diferencia entre revisiones de «tan()»

De ArduWiki
Saltar a: navegación, buscar
(Vea también)
(Advertencias)
 
(No se muestran 5 ediciones intermedias de 2 usuarios)
Línea 11: Línea 11:
  
 
== Retornos ==
 
== Retornos ==
La tangente del ángulo [[long]].
+
La tangente del ángulo [[float]].
  
 
== Advertencias ==
 
== Advertencias ==
Nada.
+
* El angulo debe estar expresado en radianes. Valores entre 0 y [[PI|TWO_PI]].
  
== Ejemplo ==
+
== Ejemplo 1 ==
<pre>
+
<syntaxhighlight lang="c++">
</pre>
+
void setup(){
 +
  Serial.begin(115200);
 +
  Serial.println(tan(0), 3);            //0.000
 +
  Serial.println(tan(HALF_PI/2), 3);    //1.000
 +
  Serial.println(tan(HALF_PI), 3);      //-22877332.000
 +
  Serial.println(tan(PI), 3);          //0.000
 +
  Serial.println(tan(PI+HALF_PI), 3);  //-83858280.000
 +
  Serial.println(tan(TWO_PI), 3);}      //0.000
 +
void loop(){
 +
  //Nada
 +
}
 +
</syntaxhighlight>
 +
 
 +
== Ejemplo 2 ==
 +
<syntaxhighlight lang="c++">
 +
void setup(){
 +
  Serial.begin(115200);
 +
}
 +
void loop(){
 +
  for (float n=0; n<TWO_PI; n += 0.01){
 +
      Serial.println(tan(n));
 +
  }
 +
}
 +
</syntaxhighlight>
  
 
== Vea también ==
 
== Vea también ==
Línea 26: Línea 49:
 
* [[acos()]]
 
* [[acos()]]
 
* [[atan()]]
 
* [[atan()]]
 +
* [[PI]]
  
 
== Referencias ==
 
== Referencias ==
 
* [https://www.arduino.cc/reference/es/language/functions/time/millis/ Guia de referencia de Arduino]
 
* [https://www.arduino.cc/reference/es/language/functions/time/millis/ Guia de referencia de Arduino]
  
[[Category:Funciones]]
+
[[Category:Funciones trigonometricas]]

Revisión actual del 18:44 24 jun 2019

Descripción

Calcula la tangente de un ángulo (en radianes). El resultado está comprendido entre negativo infinito e infinito.

Sintaxis

tan(rad);

Parámetros

rad
el ángulo en radianes float.

Retornos

La tangente del ángulo float.

Advertencias

  • El angulo debe estar expresado en radianes. Valores entre 0 y TWO_PI.

Ejemplo 1

void setup(){
   Serial.begin(115200);
   Serial.println(tan(0), 3);            //0.000
   Serial.println(tan(HALF_PI/2), 3);    //1.000
   Serial.println(tan(HALF_PI), 3);      //-22877332.000
   Serial.println(tan(PI), 3);           //0.000
   Serial.println(tan(PI+HALF_PI), 3);   //-83858280.000
   Serial.println(tan(TWO_PI), 3);}      //0.000
void loop(){
   //Nada
}

Ejemplo 2

void setup(){
   Serial.begin(115200);
}
void loop(){
   for (float n=0; n<TWO_PI; n += 0.01){
      Serial.println(tan(n));
   }
}

Vea también

Referencias