Skip to content

Commit 1a726cc

Browse files
committed
FR Translation: copy file to translate
1 parent 2777fdd commit 1a726cc

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//// { compiler: { target: 99 }, order: 1 }
2+
3+
// Did you know there is a limit to how big of a number you
4+
// can represent in JavaScript when writing ?
5+
6+
const maxHighValue = 9007199254740991;
7+
const maxLowValue = -9007199254740991;
8+
9+
// If you go one over/below these numbers
10+
// then you start to get into dangerous territory.
11+
12+
const oneOverMax = 9007199254740992;
13+
const oneBelowMin = -9007199254740992;
14+
15+
// The solution for handling numbers of this size
16+
// is to convert these numbers to BigInts instead
17+
// of a number:
18+
//
19+
// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/BigInt
20+
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.
25+
26+
// Number literals
27+
9007199254740993;
28+
-9007199254740993;
29+
9007199254740994;
30+
-9007199254740994;
31+
32+
// Hex numbers
33+
0x19999999999999;
34+
-0x19999999999999;
35+
0x20000000000000;
36+
-0x20000000000000;
37+
0x20000000000001;
38+
-0x20000000000001;

0 commit comments

Comments
 (0)