A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Math/atan below:

Math.atan() - JavaScript | MDN

Math.atan()

Baseline Widely available

Die statische Methode Math.atan() gibt den Arcustangens (im Bogenmaß) einer Zahl zurück, das heißt

𝙼𝚊𝚝𝚑.𝚊𝚝𝚊𝚗 ( 𝚡 ) = arctan ( x ) = das eindeutig  y ∊ [ − π 2 , π 2 ]  , sodass  tan ( y ) = x \mathtt{\operatorname{Math.atan}(x)}} = \arctan(x) = \text{das eindeutig } y \in \left[-\frac{\pi}{2}, \frac{\pi}{2}\right] \text{ , sodass } \tan(y) = x Probieren Sie es aus
// 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
Syntax Parameter Rückgabewert

Der Arcustangens (Winkel im Bogenmaß zwischen - π 2 -\frac{\pi}{2} und π 2 \frac{\pi}{2} , einschließlich) von x. Wenn x Infinity ist, gibt es π 2 \frac{\pi}{2} zurück. Wenn x -Infinity ist, gibt es - π 2 -\frac{\pi}{2} zurück.

Beschreibung

Da atan() eine statische Methode von Math ist, verwenden Sie sie immer als Math.atan() und nicht als Methode eines erstellten Math-Objekts (Math ist kein Konstruktor).

Beispiele Verwendung von Math.atan()
Math.atan(-Infinity); // -1.5707963267948966 (-π/2)
Math.atan(-0); // -0
Math.atan(0); // 0
Math.atan(1); // 0.7853981633974483  (π/4)
Math.atan(Infinity); // 1.5707963267948966  (π/2)

// The angle that the line (0,0) -- (x,y) forms with the x-axis in a Cartesian coordinate system
const theta = (x, y) => Math.atan(y / x);

Beachten Sie, dass Sie möglicherweise die theta-Funktion vermeiden möchten und stattdessen Math.atan2() verwenden, die einen größeren Bereich hat (zwischen -π und π) und es vermeidet, NaN für Fälle wie wenn x 0 ist, auszugeben.

Spezifikationen Browser-Kompatibilität Siehe auch MDN-Feedback-Box War diese Übersetzung hilfreich?

Diese Seite wurde automatisch aus dem Englischen übersetzt.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4