Math.atan()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
La fonction Math.atan()
renvoie l'arc tangente d'un nombre exprimée en radians. Elle est définie par :
Exemple interactif
// Calculates angle of a right-angle triangle in radians function calcAngle(opposite, adjacent) { return Math.atan(opposite / adjacent); } console.log(calcAngle(8, 10)); // Expected output: 0.6747409422235527 console.log(calcAngle(5, 3)); // Expected output: 1.0303768265243125
Syntaxe
Math.atan(x);
Paramètres
x
Un nombre.
Valeur de retour
L'arc tangente du nombre passé en argument (exprimé en radians).
Description
La méthode Math.atan()
renvoie une valeur numérique comprise entre et .
atan()
est une méthode statique de Math
et doit toujours être utilisée avec la syntaxe Math.atan()
, elle ne doit pas être utilisée comme une méthode d'un autre objet qui aurait été créé (Math
n'est pas un constructeur).
Exemples
Utiliser Math.atan()
Math.atan(1); // 0.7853981633974483 Math.atan(0); // 0 Math.atan(-0); // -0 Math.atan(Infinity); // 1.5707963267948966 Math.atan(-Infinity); // -1.5707963267948966 // L'angle formé entre la droite [(0,0);(x,y)] et l'axe des abscisses // dans un système de coordonnées cartésienne Math.atan(y / x);
Spécifications
Specification |
---|
ECMAScript® 2026 Language Specification # sec-math.atan |