Die Funktion
Math.atan()
gibt den Arkustangens (im Radiantenmaß) einer Zahl zurück:
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Syntax
Math.atan(x)
Parameter
x
- Eine Zahl.
Rückgabewert
Der Arkustangens (im Radiantenmaß) der übergebenen Zahl.
Beschreibung
Die Math.atan()
Methode gibt einen numerischen Wert zwischen und im Radiantenmaß zurück.
Weil atan()
eine statische Methode von Math ist, muss diese immer mit Math.atan()
genutzt werden, ohne dass ein Objekt von Math erstellt wird (Math
ist kein Konstruktor).
Beispiele
Verwendung von 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
// The angle that the line [(0,0);(x,y)] forms with the x-axis in a Cartesian coordinate system
Math.atan(y / x);
Beachten Sie, dass es manchmal aus stilistischen Gründen gewollt ist, dass ±Infinity
vermieden werden soll. In diesen Fällen kann die Funktion Math.atan2()
mit 0
als zweiten Parameter bessere Ergebnisse liefern.
Spezifikationen
Spezifikation | Status | Kommentar |
---|---|---|
ECMAScript 1st Edition (ECMA-262) | Standard | Initiale Definition. Implementiert in JavaScript 1.0. |
ECMAScript 5.1 (ECMA-262) Die Definition von 'Math.atan' in dieser Spezifikation. |
Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) Die Definition von 'Math.atan' in dieser Spezifikation. |
Standard | |
ECMAScript (ECMA-262) Die Definition von 'Math.atan' in dieser Spezifikation. |
Lebender Standard |
Browserkompatibilität
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.