From 39f2114f9797eb51994966c6bb8ff1814c9a4da8 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 12:36:08 +0100 Subject: unslug fr: move --- .../global_objects/bigint/asintn/index.html | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 files/fr/web/javascript/reference/global_objects/bigint/asintn/index.html (limited to 'files/fr/web/javascript/reference/global_objects/bigint/asintn/index.html') diff --git a/files/fr/web/javascript/reference/global_objects/bigint/asintn/index.html b/files/fr/web/javascript/reference/global_objects/bigint/asintn/index.html new file mode 100644 index 0000000000..8e51d25642 --- /dev/null +++ b/files/fr/web/javascript/reference/global_objects/bigint/asintn/index.html @@ -0,0 +1,76 @@ +--- +title: BigInt.asIntN() +slug: Web/JavaScript/Reference/Objets_globaux/BigInt/asIntN +tags: + - BigInt + - JavaScript + - Méthode + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/BigInt/asIntN +--- +

{{JSRef}}

+ +

La méthode statique BigInt.asIntN() permet d'écréter un nombre BigInt pour obtenir un entier signé entre 2largeur-1 et 2largeur-1-1.

+ +
{{EmbedInteractiveExample("pages/js/bigint-asintn.html")}}
+ + + +

Syntaxe

+ +
var resultat = BigInt.asIntN(largeur, bigint);
+ +

Paramètres

+ +
+
largeur
+
La quantité de bits disponible pour stocker l'entier.
+
bigint
+
L'entier qu'on souhaite stocker sur le nombre de bits indiqués.
+
+ +

Valeur de retour

+ +

La valeur de bigint modulo 2largeur comme entier signé.

+ +

Exemples

+ +

La méthode BigInt.asIntN() peut être utile pour rester dans une arithmétique sur 64 bits :

+ +
const max = 2n ** (64n - 1n) - 1n;
+
+BigInt.asIntN(64, max);
+// ↪ 9223372036854775807n
+
+BigInt.asIntN(64, max + 1n);
+// ↪ -9223372036854775807n
+// négatif car dépassement sur le nombre de bits
+
+ +

Spécifications

+ + + + + + + + + + + + +
SpécificationÉtat
BigInt proposalProposition de niveau 3.
+ +

Compatibilité des navigateurs

+ + + +

{{Compat("javascript.builtins.BigInt.asIntN")}}

+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf