CKTIS / Python
math.tan
Calcule la tangente d’un angle en radians en divisant le sinus par le cosinus.
Version : Python 3.14; repository image, production runtime not attested
Syntaxe
math.tan(x, /)Calcule la tangente d’un angle en radians en divisant le sinus par le cosinus.
À π/4 ils sont égaux, d’où 1 après arrondi, et à zéro le résultat est 0. Aux multiples impairs de π/2 le dénominateur s’annule.
Un angle approché peut donner une très grande valeur finie.
import math
assert math.isclose(math.tan(math.pi / 4), 1.0)
assert math.tan(0) == 0.0 and abs(math.tan(math.pi / 2)) > 1e12
Exemples
import math
print(round(math.tan(math.pi / 4), 6))
print(math.tan(0))
Résultat
1.0 0.0
Un angle approché peut donner une très grande valeur finie.