From 9f030ef5fd3a0dc15d94c01d0e1bbd1aba1eed54 Mon Sep 17 00:00:00 2001 From: SphinxKnight Date: Sun, 27 Jun 2021 15:03:56 +0200 Subject: Fix #756 by updating the JS operators in fr (#1306) * Update Operators landing + revamp L10N for 4 operators * Added NOT / ! - * +multiplication * Addition, exponentiation and comparison * Operateurs de comparaison * Binary ops * Missing newline, thx GH UI * Logical AND / OR * Assignment ops * Conflicting clean-up * Missing EOF newline * Fix history and redirects * FIX: fix flaws * FIX: minox typo fix * FIX: link flaws * FIX: fix tags detection Co-authored-by: tristantheb --- .../reference/operators/bitwise_or/index.html | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 files/fr/web/javascript/reference/operators/bitwise_or/index.html (limited to 'files/fr/web/javascript/reference/operators/bitwise_or') diff --git a/files/fr/web/javascript/reference/operators/bitwise_or/index.html b/files/fr/web/javascript/reference/operators/bitwise_or/index.html new file mode 100644 index 0000000000..72d4ed3043 --- /dev/null +++ b/files/fr/web/javascript/reference/operators/bitwise_or/index.html @@ -0,0 +1,104 @@ +--- +title: OU binaire (|) +slug: Web/JavaScript/Reference/Operators/Bitwise_OR +tags: + - Bitwise operator + - JavaScript + - Language feature + - Operator + - Reference +browser-compat: javascript.operators.bitwise_or +translation-of: Web/JavaScript/Reference/Operators/Bitwise_OR +--- +
{{jsSidebar("Operators")}}
+ +

L'opérateur OU binaire (|) renvoie un nombre dont la représentation binaire est une séquence de bits où il y a un 1 pour chaque position où au moins un des bits des deux opérandes vaut 1.

+ +
{{EmbedInteractiveExample("pages/js/expressions-bitwise-or.html")}}
+ +

Syntaxe

+ +
+a | b
+
+ +

Description

+ +

Les opérandes sont convertis en entiers sur 32 bits et exprimés comme une séquence de bits. Les nombres sur plus de 32 bits ont leurs bits en excès écartés. Par exemple, l'entier suivant nécessite plus de 32 bits pour être représenté et il sera converti en un entier sur 32 bits :

+ +
+Avant:  11100110111110100000000000000110000000000001
+Après:              10100000000000000110000000000001
+
+ +

Chaque bit du premier opérande est associé avec le bit correspondant du second opérande. Lorsqu'au moins un de ces bit vaut 1, le bit correspondant du résultat sera placé à 1. Le résultat est donc construit binairement.

+ +

La table de vérité pour l'opérateur OU est :

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
aba OU b
000
011
101
111
+ +
+     9 (base 10) = 00000000000000000000000000001001 (base 2)
+    14 (base 10) = 00000000000000000000000000001110 (base 2)
+                   --------------------------------
+14 | 9 (base 10) = 00000000000000000000000000001111 (base 2) = 15 (base 10)
+
+ +

Utiliser le OU binaire avec n'importe quel nombre x d'une part et 0 renverra toujours x.

+ +

Exemples

+ +

Utiliser l'opérateur OU binaire

+ +
+// 9  (00000000000000000000000000001001)
+// 14 (00000000000000000000000000001110)
+
+14 | 9;
+// 15 (00000000000000000000000000001111)
+
+ +

Spécifications

+ +

{{Specifications}}

+ +

Compatibilité des navigateurs

+ +

{{Compat}}

+ +

Voir aussi

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