From bf8e099b9c8b3c60d60b3712b4fc97b052c39887 Mon Sep 17 00:00:00 2001 From: julieng Date: Tue, 3 Aug 2021 08:03:23 +0200 Subject: convert content to md --- .../global_objects/bigint/asintn/index.md | 64 +++++++++------------- 1 file changed, 26 insertions(+), 38 deletions(-) (limited to 'files/fr/web/javascript/reference/global_objects/bigint/asintn') diff --git a/files/fr/web/javascript/reference/global_objects/bigint/asintn/index.md b/files/fr/web/javascript/reference/global_objects/bigint/asintn/index.md index 13023405cf..3465ce6c21 100644 --- a/files/fr/web/javascript/reference/global_objects/bigint/asintn/index.md +++ b/files/fr/web/javascript/reference/global_objects/bigint/asintn/index.md @@ -9,34 +9,33 @@ tags: translation_of: Web/JavaScript/Reference/Global_Objects/BigInt/asIntN original_slug: Web/JavaScript/Reference/Objets_globaux/BigInt/asIntN --- -

{{JSRef}}

+{{JSRef}} -

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

+La méthode statique **`BigInt.asIntN()`** permet d'écréter un nombre `BigInt` pour obtenir un entier signé entre 2^(largeur-1) et 2^(largeur-1)-1. -
{{EmbedInteractiveExample("pages/js/bigint-asintn.html")}}
+{{EmbedInteractiveExample("pages/js/bigint-asintn.html")}} -

Syntaxe

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

Paramètres

+### 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.
-
+- `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

+### Valeur de retour -

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

+La valeur de `bigint` modulo 2^`largeur` comme entier signé. -

Exemples

+## Exemples -

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

+La méthode `BigInt.asIntN()` peut être utile pour rester dans une arithmétique sur 64 bits : -
const max = 2n ** (64n - 1n) - 1n;
+```js
+const max = 2n ** (64n - 1n) - 1n;
 
 BigInt.asIntN(64, max);
 // ↪ 9223372036854775807n
@@ -44,30 +43,19 @@ BigInt.asIntN(64, max);
 BigInt.asIntN(64, max + 1n);
 // ↪ -9223372036854775807n
 // négatif car dépassement sur le nombre de bits
-
+``` -

Spécifications

+## Spécifications - - - - - - - - - - - -
SpécificationÉtat
BigInt proposalProposition de niveau 3.
+| Spécification | État | +| ---------------------------------------------------------------------------- | ------------------------ | +| [BigInt proposal](https://tc39.github.io/proposal-bigint/#sec-bigint.asintn) | Proposition de niveau 3. | -

Compatibilité des navigateurs

+## Compatibilité des navigateurs -

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

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

Voir aussi

+## Voir aussi - +- {{JSxRef("BigInt")}} +- {{JSxRef("BigInt.asUintN()")}} -- cgit v1.2.3-54-g00ecf