aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/operators/bitwise_not
diff options
context:
space:
mode:
authorSphinxKnight <SphinxKnight@users.noreply.github.com>2021-06-27 15:03:56 +0200
committerGitHub <noreply@github.com>2021-06-27 15:03:56 +0200
commit9f030ef5fd3a0dc15d94c01d0e1bbd1aba1eed54 (patch)
treee6aa6c44ea4c523dbf72464e77745bed1efc8c51 /files/fr/web/javascript/reference/operators/bitwise_not
parentdc9842009bd95e0db7e058a5ebb98f27d6a3f650 (diff)
downloadtranslated-content-9f030ef5fd3a0dc15d94c01d0e1bbd1aba1eed54.tar.gz
translated-content-9f030ef5fd3a0dc15d94c01d0e1bbd1aba1eed54.tar.bz2
translated-content-9f030ef5fd3a0dc15d94c01d0e1bbd1aba1eed54.zip
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 <tristantheb@gmail.com>
Diffstat (limited to 'files/fr/web/javascript/reference/operators/bitwise_not')
-rw-r--r--files/fr/web/javascript/reference/operators/bitwise_not/index.html90
1 files changed, 90 insertions, 0 deletions
diff --git a/files/fr/web/javascript/reference/operators/bitwise_not/index.html b/files/fr/web/javascript/reference/operators/bitwise_not/index.html
new file mode 100644
index 0000000000..f3e1856a90
--- /dev/null
+++ b/files/fr/web/javascript/reference/operators/bitwise_not/index.html
@@ -0,0 +1,90 @@
+---
+title: NON binaire (~)
+slug: Web/JavaScript/Reference/Operators/Bitwise_NOT
+tags:
+ - Bitwise operator
+ - JavaScript
+ - Language feature
+ - Operator
+ - Reference
+browser-compat: javascript.operators.bitwise_not
+translation_of: Web/JavaScript/Reference/Operators/Bitwise_NOT
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p>L'opérateur binaire NON (<code>~</code>) prend l'opposé de chaque bit de son opérande et fournit la valeur ainsi obtenue. À l'instar des autres opérateurs binaires, il convertit son opérande en un entier signé sur 32 bits.</p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-bitwise-not.html")}}</div>
+
+<h2 id="syntaxe">Syntaxe</h2>
+
+<pre class="brush: js">
+~a
+</pre>
+
+<h2 id="description">Description</h2>
+
+<p>L'opérande est converti en un entier signé sur 32 bits. Les nombres avec plus de 32 bits voient leurs bits les plus significatifs être tronqués. Voici un exemple où l'entier qui suit est supérieur à une valeur pouvant être exprimée sur 32 bits : la conversion écrête la valeur pour obtenir un entier signé sur 32 bits :</p>
+
+<pre class="brush: js">
+Avant : 11100110111110100000000000000110000000000001
+Après : 10100000000000000110000000000001
+</pre>
+
+<p>Pour former le résultat, chaque bit qui compose l'opérande est inversé.</p>
+
+<p>La table de vérité pour l'opération <code>NON</code> est :</p>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th class="header" scope="col">a</th>
+ <th class="header" scope="col">NON a</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>0</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td>0</td>
+ </tr>
+ </tbody>
+</table>
+
+<pre class="brush: js">
+ 9 (base 10) = 00000000000000000000000000001001 (base 2)
+ --------------------------------
+~9 (base 10) = 11111111111111111111111111110110 (base 2) = -10 (base 10)
+</pre>
+
+<p>L'entier signé sur 32 bits est inversé selon <a href="https://fr.wikipedia.org/wiki/Compl%C3%A9ment_%C3%A0_deux">le complément à deux</a>. Autrement dit, la présence du bit le plus significatif est utilisée pour exprimer des entiers négatifs.</p>
+
+<p>Appliquer un NON binaire sur n'importe quel nombre <code>x</code> fournira la valeur <code>-(x + 1)</code>. Ainsi, <code>~-5</code> renverra <code>4</code>.</p>
+
+<p>Étant donné l'utilisation d'une représentation sur 32 bits, <code>~-1</code> et <code>~4294967295</code> (2^32 - 1) donneront tous les deux <code>0</code>.</p>
+
+<h2 id="examples">Exemples</h2>
+
+<h3 id="Using_bitwise_NOT">Utiliser le NON binaire</h3>
+
+<pre class="brush: js">~0; // -1
+~-1; // 0
+~1; // -2
+</pre>
+
+<h2 id="specifications">Spécifications</h2>
+
+<p>{{Specifications}}</p>
+
+<h2 id="browser_compatibility">Compatibilité des navigateurs</h2>
+
+<p>{{Compat}}</p>
+
+<h2 id="see_also">Voir aussi</h2>
+
+<ul>
+ <li><a href="/fr/docs/Web/JavaScript/Guide/Expressions_and_Operators#bitwise">Les opérateurs binaires dans le guide JavaScript</a></li>
+</ul>