Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3eee1c9

Browse files
authoredJul 13, 2022
Update article.md
změna ohledně rozsahu celých čísel
1 parent 8d0a6a9 commit 3eee1c9

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed
 

‎1-js/02-first-steps/05-types/article.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,25 +70,20 @@ O práci s čísly si povíme víc v kapitole <info:number>.
7070
## BigInt [#bigint-type]
7171

7272
<<<<<<< HEAD
73-
Typ „číslo“ v JavaScriptu nedokáže reprezentovat celočíselné hodnoty větší než <code>(2<sup>53</sup>-1)</code> (což je `9007199254740991`), nebo záporné hodnoty nižší než <code>-(-2<sup>53</sup>-1)</code>. Toto technické omezení je dáno jeho vnitřní reprezentací.
73+
Typ „číslo“ v JavaScriptu nedokáže reprezentovat celočíselné hodnoty větší než <code>(2<sup>53</sup>-1)</code> (což je `9007199254740991`), nebo záporné hodnoty nižší než <code>-(-2<sup>53</sup>-1)</code>.
7474

75-
Pro většinu účelů to stačí, ale někdy potřebujeme opravdu velká čísla, např. pro kryptografii nebo časová razítka s přesností na mikrosekundy.
76-
=======
77-
In JavaScript, the "number" type cannot safely represent integer values larger than <code>(2<sup>53</sup>-1)</code> (that's `9007199254740991`), or less than <code>-(2<sup>53</sup>-1)</code> for negatives.
75+
Abychom byli opravdu přesní, typ `číslo` umí ukládat větší celá čísla (až do <code>1.7976931348623157 * 10<sup>308</sup></code>), ale mimo bezpečného celočíselného intervalu <code>±(2<sup>53</sup>-1)</code> nastane chyba přesnosti, jelikož do pevného 64-bitového úložiště se nevejdou všechny číslice. Může být tedy uložena „přibližná“ hodnota.
7876

79-
To be really precise, the "number" type can store larger integers (up to <code>1.7976931348623157 * 10<sup>308</sup></code>), but outside of the safe integer range <code>±(2<sup>53</sup>-1)</code> there'll be a precision error, because not all digits fit into the fixed 64-bit storage. So an "approximate" value may be stored.
80-
81-
For example, these two numbers (right above the safe range) are the same:
77+
Například tato dvě čísla (těsně nad bezpečným intervalem) budou stejná:
8278

8379
```js
8480
console.log(9007199254740991 + 1); // 9007199254740992
8581
console.log(9007199254740991 + 2); // 9007199254740992
8682
```
8783

88-
So to say, all odd integers greater than <code>(2<sup>53</sup>-1)</code> can't be stored at all in the "number" type.
84+
Dá se tedy říci, že do typu `number` nelze uložit žádné liché celé číslo větší než <code>(2<sup>53</sup>-1)</code>.
8985

90-
For most purposes <code>±(2<sup>53</sup>-1)</code> range is quite enough, but sometimes we need the entire range of really big integers, e.g. for cryptography or microsecond-precision timestamps.
91-
>>>>>>> 82ed8f11b40bd40797427a5dd1763edbe1fca523
86+
Pro většinu účelů je interval <code>±(2<sup>53</sup>-1)</code> dostačující, ale někdy potřebujeme opravdu velká čísla, např. pro kryptografii nebo časová razítka s přesností na mikrosekundy.
9287

9388
Proto byl do jazyka nedávno přidán typ `BigInt`, který představuje celá čísla libovolné délky.
9489

0 commit comments

Comments
 (0)
Please sign in to comment.