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 :

Math.atan(x)=arctan(x)=le seuly[-π2;π2]tel quetan(y)=x\mathtt{\operatorname{Math.atan}(x)} = \arctan(x) = \text{ the unique } ; y \in \left[-\frac{\pi}{2}; \frac{\pi}{2}\right] , \text{such that} ; \tan(y) = x

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

js
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 -π2-\frac{\pi}{2} et π2\frac{\pi}{2}.

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()

js
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® 2025 Language Specification
# sec-math.atan

Compatibilité des navigateurs

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
atan

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Voir aussi