--- title: Number.MAX_SAFE_INTEGER slug: Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER tags: - ECMAScript 2015 - JavaScript - Number - Property translation_of: Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER --- <div>{{JSRef}}</div> <p>Die <code><strong>Number.MAX_SAFE_INTEGER</strong></code> Konstante repräsentiert die größte, sichere, ganze Zahl in JavaScript (<code>2<sup>53</sup> - 1</code>).</p> <div>{{EmbedInteractiveExample("pages/js/number-maxsafeinteger.html")}}</div> <div>{{js_property_attributes(0, 0, 0)}}</div> <h2 id="Beschreibung">Beschreibung</h2> <p>Die <code>MAX_SAFE_INTEGER</code> Konstante hat einen Wert von <code>9007199254740991</code> (9.007.199.254.740.991 oder ca. 9 <span class="short_text" id="result_box" lang="de"><span>Billiarde</span></span>). Die Bedeutung hinter dieser Zahl ist, dass in JavaScript <a href="http://en.wikipedia.org/wiki/Double_precision_floating-point_format">double-precision floating-point Zahlen</a> wie sie in <a href="http://en.wikipedia.org/wiki/IEEE_floating_point">IEEE 754</a> spezifiziert sind benutzt werden. Nach dieser Spezifikation ist die sichere Repräsentation von Zahlen nur zwischen <code>-(2<sup>53</sup> - 1)</code> und <code>2<sup>53</sup> - 1</code> möglich.</p> <p>Sicher heißt in diesem Kontext, dass es möglich ist ganze Zahlen exakt zu repräsentieren und sie korrekt zu vergleichen. Zum Beispiel wird <code>Number.MAX_SAFE_INTEGER + 1 === Number.MAX_SAFE_INTEGER + 2</code> zu <code>true</code> ausgewertet, was mathematisch nicht richtig ist. Weiter Informationen sind im Artikel {{jsxref("Number.isSafeInteger()")}} zu finden. </p> <p>Weil <code>MAX_SAFE_INTEGER</code> eine statische Eigenschaft von {{jsxref("Number")}} ist, wird sie immer mit <code>Number.MAX_SAFE_INTEGER</code> abgerufen, im Gegensatz zu einer Eigenschaft eines {{jsxref("Number")}} Objektes, was erstellt wurde.</p> <h2 id="Beispiele">Beispiele</h2> <pre class="brush: js">Number.MAX_SAFE_INTEGER // 9007199254740991 Math.pow(2, 53) - 1 // 9007199254740991 </pre> <h2 id="Spezifikationen">Spezifikationen</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">Spezifikation</th> <th scope="col">Status</th> <th scope="col">Kommentar</th> </tr> <tr> <td>{{SpecName('ES2015', '#sec-number.max_safe_integer', 'Number.MAX_SAFE_INTEGER')}}</td> <td>{{Spec2('ES2015')}}</td> <td>Initiale Definition.</td> </tr> <tr> <td>{{SpecName('ESDraft', '#sec-number.max_safe_integer', 'Number.MAX_SAFE_INTEGER')}}</td> <td>{{Spec2('ESDraft')}}</td> <td> </td> </tr> </tbody> </table> <h2 id="Browserkompatibilität">Browserkompatibilität</h2> <p>{{Compat("javascript.builtins.Number.MAX_SAFE_INTEGER")}}</p> <h2 id="Siehe_auch">Siehe auch</h2> <ul> <li>{{jsxref("Number.MIN_SAFE_INTEGER")}}</li> <li>{{jsxref("Number.isSafeInteger()")}}</li> </ul>