|
1 | 1 | //// { compiler: { target: 99 }, order: 1 }
|
2 | 2 |
|
3 |
| -// Did you know there is a limit to how big of a number you |
4 |
| -// can represent in JavaScript when writing ? |
| 3 | +// Saviez vous qu'il existe une limite à la taille des nombres qu'il est possible |
| 4 | +// de représenter en JavaScript ? |
5 | 5 |
|
6 | 6 | const maxHighValue = 9007199254740991;
|
7 | 7 | const maxLowValue = -9007199254740991;
|
8 | 8 |
|
9 |
| -// If you go one over/below these numbers |
10 |
| -// then you start to get into dangerous territory. |
| 9 | +// Si vous augmentez / diminuez d'une unité ces nombres vous commencez a courir un |
| 10 | +// risque. |
11 | 11 |
|
12 | 12 | const oneOverMax = 9007199254740992;
|
13 | 13 | const oneBelowMin = -9007199254740992;
|
14 | 14 |
|
15 |
| -// The solution for handling numbers of this size |
16 |
| -// is to convert these numbers to BigInts instead |
17 |
| -// of a number: |
| 15 | +// La solution pour manipuler des nombres de cette taille est de les convertir en |
| 16 | +// BigInts: |
18 | 17 | //
|
19 |
| -// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/BigInt |
| 18 | +// https://developer.mozilla.org/fr/docs/orphaned/Web/JavaScript/Reference/Global_Objects/BigInt |
20 | 19 |
|
21 |
| -// TypeScript will now offer a fixit for number |
22 |
| -// literals which are above 2^52 (positive / negative) |
23 |
| -// which adds the suffix "n" which informs JavaScript |
24 |
| -// that the type should be BigInt. |
| 20 | +// TypeScript désormais propose une correction automatique, pour des nombres |
| 21 | +// supérieurs à 2^52 (positif / negatif). |
| 22 | +// Cette correction automatique ajoute le suffixe "n", ce qui informe JavaScript |
| 23 | +// que le type doit être BigInt. |
25 | 24 |
|
26 |
| -// Number literals |
| 25 | +// Nombres |
27 | 26 | 9007199254740993;
|
28 | 27 | -9007199254740993;
|
29 | 28 | 9007199254740994;
|
30 | 29 | -9007199254740994;
|
31 | 30 |
|
32 |
| -// Hex numbers |
| 31 | +// Nombres hexadécimaux |
33 | 32 | 0x19999999999999;
|
34 | 33 | -0x19999999999999;
|
35 | 34 | 0x20000000000000;
|
|
0 commit comments