--- title: Math.PI slug: Web/JavaScript/Reference/Global_Objects/Math/PI tags: - JavaScript - Math - Property - Reference translation_of: Web/JavaScript/Reference/Global_Objects/Math/PI ---
Die Math.PI Eigenschaft repräsentiert die Kreiszahl Pi, welche als Verhältnis zwischen Kreisumfang und Durchmesser definiert ist und gerundet die Zahl 3,14159 ist.
Weil PI eine statische Eigenschaft von Math ist, muss immer Math.PI genutzt werden, ohne dass ein Math Objekt erstellt wird (Math ist kein Konstruktor).
Math.PIDie folgende Funktion benutzt Math.PI, um aus einem Radius den Umfrang eines Kreises zu berechnen:
function calculateCircumference(radius) {
return Math.PI * (radius + radius);
}
calculateCircumference(1); // 6.283185307179586
| Spezifikation | Status | Kommentar |
|---|---|---|
| {{SpecName('ES1')}} | {{Spec2('ES1')}} | Initiale Definition. Implementiert in JavaScript 1.0. |
| {{SpecName('ES5.1', '#sec-15.8.1.6', 'Math.PI')}} | {{Spec2('ES5.1')}} | |
| {{SpecName('ES6', '#sec-math.pi', 'Math.PI')}} | {{Spec2('ES6')}} | |
| {{SpecName('ESDraft', '#sec-math.pi', 'Math.PI')}} | {{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.PI")}}