Math.atan()
La funzione Math.atan()
restituisce l'arcotangente (in radianti) di un numero, definita come
Sintassi
Math.atan(x)
Parametri
x
- Un numero.
Valore di ritorno
L'arcotangente (in radianti) del numero dato x
.
Descrizione
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).
Esempî
Using 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, Math.atan2()
with 0
as the second argument may be a better solution.
Specifiche
Specifica | Status | Commento |
---|---|---|
ECMAScript 1st Edition (ECMA-262) | Standard | Definizione iniziale. Implementata in JavaScript 1.0. |
ECMAScript 5.1 (ECMA-262) The definition of 'Math.atan' in that specification. |
Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Math.atan' in that specification. |
Standard | |
ECMAScript (ECMA-262) The definition of 'Math.atan' in that specification. |
Living Standard |
Compatibilità con i browser
BCD tables only load in the browser
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.