--- title: Math.atan() slug: Web/JavaScript/Reference/Global_Objects/Math/atan translation_of: Web/JavaScript/Reference/Global_Objects/Math/atan ---
La funzione Math.atan()
restituisce l'arcotangente (in radianti) di un numero, definita come
Math.atan(x)
x
L'arcotangente (in radianti) del numero dato x
.
Il metodo Math.atan()
ritorna un valore numerico compreso tra e radianti.
Poiché atan()
è un membro statico di Math
, è da usarsi sempre nella forma Math.atan()
, piuttosto che come un metodo di un oggetto Math
creato (Math
non è il costruttore di una classe).
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'angolo che la retta su cui giace il segmento [(0,0);(x,y)]
forma con l'asse x di un sistema a coordinate cartesiane
*/
Math.atan(y / x);
Note that you may want to avoid using ±Infinity
for stylistic reasons. In this case, {{jsxref("Math.atan2()")}} with 0
as the second argument may be a better solution.
Specifica | Status | Commento |
---|---|---|
{{SpecName('ES1')}} | {{Spec2('ES1')}} | Definizione iniziale. Implementata in JavaScript 1.0. |
{{SpecName('ES5.1', '#sec-15.8.2.4', 'Math.atan')}} | {{Spec2('ES5.1')}} | |
{{SpecName('ES6', '#sec-math.atan', 'Math.atan')}} | {{Spec2('ES6')}} | |
{{SpecName('ESDraft', '#sec-math.atan', 'Math.atan')}} | {{Spec2('ESDraft')}} |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("javascript.builtins.Math.atan")}}