Šestnástková sústava: Rozdiel medzi revíziami
d robot Pridal: ms:Nombor perenambelasan |
L ---> 1 |
||
Riadok 1: | Riadok 1: | ||
{{0%}} |
{{0%}} |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | Iné často používané sústavy sú [[desiatková sústava]] a [[Binárna číselná sústava|dvojková sústava]]. Kým desiatková sústava používa na zápis znaky ''0'', ''1'', ''2'', ..., ''9'' a binárna znaky ''1'' a ''0'', šestnástková sústava používa znaky ''0'',''1'',''2'',...,''9'', ''a'', ''b'', ''c'', ''d'', ''e'' a ''f'' (resp. veľké písmená ''A'', ''B'', ''C'', ''D'', ''E'', ''F''), kde uvedené [[latinská abeceda|latinské]] písmená označujú po rade čísla 10, 11, 12, 13, 14 a 15 desiatkovej sústavy, ktorú bežne používame. |
||
[[Image:Logictesseract.jpg|right|300px]] |
|||
⚫ | |||
⚫ | |||
| style="background:black; width:2px" | || || || || || || || || || || || |
| style="background:black; width:2px" | || || || || || || || || || || || |
||
|-style="background:#FDC888; color:black; height:24px" |
|-style="background:#FDC888; color:black; height:24px" |
||
| style="background:black; width:2px" | || style="width:45px"|'''0'''<sub>hex</sub> || = || style="width:45px"|0<sub>dec</sub> || = || style="width:45px"|0<sub>oct</sub> ||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:white;width:24px"|0 ||style="background:black; width:2px" | |
| style="background:black; width:2px" | || style="width:45px"|'''0'''<sub>hex</sub> || = || style="width:45px"|0<sub>dec</sub> || = || style="width:45px"|0<sub>oct</sub> ||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:white;width:24px"|0 ||style="background:black; width:2px" | |
||
|-style="background:#E3EDE9; color:black; height:24px" |
|-style="background:#E3EDE9; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''1'''<sub>hex</sub> || = || 1<sub>dec</sub> || = || 1<sub>oct</sub>||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''1'''<sub>hex</sub> || = || 1<sub>dec</sub> || = || 1<sub>oct</sub> ||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:red;width:24px"|1||style="background:black; width:2px" | |
||
|-style="background:#E3EDE9; color:black; height:24px" |
|-style="background:#E3EDE9; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''2'''<sub>hex</sub> || = || 2<sub>dec</sub> ||= || 2<sub>oct</sub>||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''2'''<sub>hex</sub> || = || 2<sub>dec</sub> ||= || 2<sub>oct</sub> ||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:red;width:24px"|1|| style="background:white;width:24px"|0||style="background:black; width:2px" | |
||
|-style="background:#FDC888; color:black; height:24px" |
|-style="background:#FDC888; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''3'''<sub>hex</sub> || = || 3<sub>dec</sub> || = || 3<sub>oct</sub>||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''3'''<sub>hex</sub> || = || 3<sub>dec</sub> || = || 3<sub>oct</sub> ||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:red;width:24px"|1|| style="background:red;width:24px"|1||style="background:black; width:2px" | |
||
|- style="background:black; height:2px" |
|- style="background:black; height:2px" |
||
| style="background:black; width:2px" | || || || || || || || || || || || |
| style="background:black; width:2px" | || || || || || || || || || || || |
||
|-style="background:#E3EDE9; color:black; height:24px" |
|-style="background:#E3EDE9; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''4'''<sub>hex</sub> || = || 4<sub>dec</sub> ||= || 4<sub>oct</sub>||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''4'''<sub>hex</sub> || = || 4<sub>dec</sub> ||= || 4<sub>oct</sub> ||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:red;width:24px"|1|| style="background:white;width:24px"|0|| style="background:white;width:24px"|0||style="background:black; width:2px" | |
||
|-style="background:#FDC888; color:black; height:24px" |
|-style="background:#FDC888; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''5'''<sub>hex</sub> || = || 5<sub>dec</sub> || = || 5<sub>oct</sub>||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''5'''<sub>hex</sub> || = || 5<sub>dec</sub> || = || 5<sub>oct</sub> ||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:red;width:24px"|1|| style="background:white;width:24px"|0|| style="background:red;width:24px"|1||style="background:black; width:2px" | |
||
|-style="background:#FEE978; color:black; height:24px" |
|-style="background:#FEE978; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''6'''<sub>hex</sub> || = || 6<sub>dec</sub> ||= || 6<sub>oct</sub>||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''6'''<sub>hex</sub> || = || 6<sub>dec</sub> ||= || 6<sub>oct</sub> ||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:red;width:24px"|1|| style="background:red;width:24px"|1|| style="background:white;width:24px"|0||style="background:black; width:2px" | |
||
|-style="background:#E3EDE9; color:black; height:24px" |
|-style="background:#E3EDE9; color:black; height:24px" |
||
| style="background:black; width:2px" | ||'''7'''<sub>hex</sub> || = || 7<sub>dec</sub> || = || 7<sub>oct</sub>||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:red;width:24px"| |
| style="background:black; width:2px" | ||'''7'''<sub>hex</sub> || = || 7<sub>dec</sub> || = || 7<sub>oct</sub> ||style="background:black; width:2px" | || style="background:white;width:24px"|0|| style="background:red;width:24px"|1|| style="background:red;width:24px"|1|| style="background:red;width:24px"|1||style="background:black; width:2px" | |
||
|- style="background:black; height:2px" |
|- style="background:black; height:2px" |
||
| style="background:black; width:2px" | || || || || || || || || || || || |
| style="background:black; width:2px" | || || || || || || || || || || || |
||
|-style="background:#E3EDE9; color:black; height:24px" |
|-style="background:#E3EDE9; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''8'''<sub>hex</sub> || = || 8<sub>dec</sub> || = || 10<sub>oct</sub>||style="background:black; width:2px" | || style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''8'''<sub>hex</sub> || = || 8<sub>dec</sub> || = || 10<sub>oct</sub> ||style="background:black; width:2px" | || style="background:red;width:24px"|1|| style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:white;width:24px"|0||style="background:black; width:2px" | |
||
|-style="background:#FEE978; color:black; height:24px" |
|-style="background:#FEE978; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''9'''<sub>hex</sub> || = || 9<sub>dec</sub> ||= || 11<sub>oct</sub>||style="background:black; width:2px" | || style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''9'''<sub>hex</sub> || = || 9<sub>dec</sub> ||= || 11<sub>oct</sub> ||style="background:black; width:2px" | || style="background:red;width:24px"|1|| style="background:white;width:24px"|0|| style="background:white;width:24px"|0|| style="background:red;width:24px"|1||style="background:black; width:2px" | |
||
|-style="background:#FDC888; color:black; height:24px" |
|-style="background:#FDC888; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''A'''<sub>hex</sub>|| = || 10<sub>dec</sub> || = || 12<sub>oct</sub>||style="background:black; width:2px" | || style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''A'''<sub>hex</sub>|| = || 10<sub>dec</sub> || = || 12<sub>oct</sub> ||style="background:black; width:2px" | || style="background:red;width:24px"|1|| style="background:white;width:24px"|0|| style="background:red;width:24px"|1|| style="background:white;width:24px"|0||style="background:black; width:2px" | |
||
|-style="background:#E3EDE9; color:black; height:24px" |
|-style="background:#E3EDE9; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''B'''<sub>hex</sub>|| = || 11<sub>dec</sub> || = || 13<sub>oct</sub>||style="background:black; width:2px" | || style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''B'''<sub>hex</sub>|| = || 11<sub>dec</sub> || = || 13<sub>oct</sub> ||style="background:black; width:2px" | || style="background:red;width:24px"|1|| style="background:white;width:24px"|0|| style="background:red;width:24px"|1|| style="background:red;width:24px"|1||style="background:black; width:2px" | |
||
|- style="background:black; height:2px" |
|- style="background:black; height:2px" |
||
| style="background:black; width:2px" | || || || || || || || || || || || |
| style="background:black; width:2px" | || || || || || || || || || || || |
||
|-style="background:#FDC888; color:black; height:24px" |
|-style="background:#FDC888; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''C'''<sub>hex</sub>|| = || 12<sub>dec</sub> || = || 14<sub>oct</sub>||style="background:black; width:2px" | || style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''C'''<sub>hex</sub>|| = || 12<sub>dec</sub> || = || 14<sub>oct</sub> ||style="background:black; width:2px" | || style="background:red;width:24px"|1|| style="background:red;width:24px"|1|| style="background:white;width:24px"|0|| style="background:white;width:24px"|0||style="background:black; width:2px" | |
||
|-style="background:#E3EDE9; color:black; height:24px" |
|-style="background:#E3EDE9; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''D'''<sub>hex</sub>|| = || 13<sub>dec</sub> ||= || 15<sub>oct</sub>||style="background:black; width:2px" | || style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''D'''<sub>hex</sub>|| = || 13<sub>dec</sub> ||= || 15<sub>oct</sub> ||style="background:black; width:2px" | || style="background:red;width:24px"|1|| style="background:red;width:24px"|1|| style="background:white;width:24px"|0|| style="background:red;width:24px"|1||style="background:black; width:2px" | |
||
|-style="background:#E3EDE9; color:black; height:24px" |
|-style="background:#E3EDE9; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''E'''<sub>hex</sub>|| = || 14<sub>dec</sub> ||= || 16<sub>oct</sub>||style="background:black; width:2px" | || style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''E'''<sub>hex</sub>|| = || 14<sub>dec</sub> ||= || 16<sub>oct</sub> ||style="background:black; width:2px" | || style="background:red;width:24px"|1|| style="background:red;width:24px"|1|| style="background:red;width:24px"|1|| style="background:white;width:24px"|0||style="background:black; width:2px" | |
||
|-style="background:#FDC888; color:black; height:24px" |
|-style="background:#FDC888; color:black; height:24px" |
||
| style="background:black; width:2px" | || '''F'''<sub>hex</sub>|| = || 15<sub>dec</sub> || = || 17<sub>oct</sub>||style="background:black; width:2px" | || style="background:red;width:24px"| |
| style="background:black; width:2px" | || '''F'''<sub>hex</sub>|| = || 15<sub>dec</sub> || = || 17<sub>oct</sub> ||style="background:black; width:2px" | || style="background:red;width:24px"|1|| style="background:red;width:24px"|1|| style="background:red;width:24px"|1|| style="background:red;width:24px"|1||style="background:black; width:2px" | |
||
|- style="background:black; height:2px" |
|- style="background:black; height:2px" |
||
| style="background:black; width:2px" | || || || || || || || || || || || |
| style="background:black; width:2px" | || || || || || || || || || || || |
||
|} |
|} |
||
⚫ | |||
⚫ | Iné často používané sústavy sú [[desiatková sústava]] a [[Binárna číselná sústava|dvojková sústava]]. Kým desiatková sústava používa na zápis znaky ''0'', ''1'', ''2'', ..., ''9'' a binárna znaky ''1'' a ''0'', šestnástková sústava používa znaky ''0'',''1'',''2'',...,''9'', ''a'', ''b'', ''c'', ''d'', ''e'' a ''f'' (resp. veľké písmená ''A'', ''B'', ''C'', ''D'', ''E'', ''F''), kde uvedené [[latinská abeceda|latinské]] písmená označujú po rade čísla 10, 11, 12, 13, 14 a 15 desiatkovej sústavy, ktorú bežne používame. |
||
Pre porovnanie, v desiatkovej sústave zapisujeme čísla nasledovne: |
Pre porovnanie, v desiatkovej sústave zapisujeme čísla nasledovne: |
Verzia z 16:39, 22. november 2007
Šestnástková alebo hexadecimálna číselná sústava je pozičná číselná sústava, čiže spôsob zápisu čísel, používaný najmä v informatike.
Iné často používané sústavy sú desiatková sústava a dvojková sústava. Kým desiatková sústava používa na zápis znaky 0, 1, 2, ..., 9 a binárna znaky 1 a 0, šestnástková sústava používa znaky 0,1,2,...,9, a, b, c, d, e a f (resp. veľké písmená A, B, C, D, E, F), kde uvedené latinské písmená označujú po rade čísla 10, 11, 12, 13, 14 a 15 desiatkovej sústavy, ktorú bežne používame.
0hex | = | 0dec | = | 0oct | 0 | 0 | 0 | 0 | |||
1hex | = | 1dec | = | 1oct | 0 | 0 | 0 | 1 | |||
2hex | = | 2dec | = | 2oct | 0 | 0 | 1 | 0 | |||
3hex | = | 3dec | = | 3oct | 0 | 0 | 1 | 1 | |||
4hex | = | 4dec | = | 4oct | 0 | 1 | 0 | 0 | |||
5hex | = | 5dec | = | 5oct | 0 | 1 | 0 | 1 | |||
6hex | = | 6dec | = | 6oct | 0 | 1 | 1 | 0 | |||
7hex | = | 7dec | = | 7oct | 0 | 1 | 1 | 1 | |||
8hex | = | 8dec | = | 10oct | 1 | 0 | 0 | 0 | |||
9hex | = | 9dec | = | 11oct | 1 | 0 | 0 | 1 | |||
Ahex | = | 10dec | = | 12oct | 1 | 0 | 1 | 0 | |||
Bhex | = | 11dec | = | 13oct | 1 | 0 | 1 | 1 | |||
Chex | = | 12dec | = | 14oct | 1 | 1 | 0 | 0 | |||
Dhex | = | 13dec | = | 15oct | 1 | 1 | 0 | 1 | |||
Ehex | = | 14dec | = | 16oct | 1 | 1 | 1 | 0 | |||
Fhex | = | 15dec | = | 17oct | 1 | 1 | 1 | 1 | |||
Pre porovnanie, v desiatkovej sústave zapisujeme čísla nasledovne:
- zápis 52 znamená číslo 5×10 + 2×1
- zápis 1027 označuje číslo 1x103 + 0x102 + 2x101 + 7x100 = 1×1000 + 0×100 + 2×10 + 7×1
V šestnástkovej sústave tieto čísla vyzerajú nasledovne:
- číslo 52 sa zapisuje ako 34, t.j. 3×16 + 4×1
- číslo 1027 zapiseme ako 403, t.j. 4×162 + 0×161 + 3×160 = 4×256 + 0×16 + 3×1 = 1027
Šestnástková sústava je užitočná najmä pre potreby informatikov a hardvérovych inžinierov. Zapisujú sa v nej najčastejšie hodnoty registrov, premenných a pod. Dôvodom jej užitočnosti je, ze dnešné počítače pracujú na základe dvojkovej sústavy, a číslo 16 je prirodzená mocnina čísla dva (16 = 24). To znamená, že jedným znakom v šestnástkovej sústave zachytíme stav 4 po sebe idúcich bitov. Ak napríklad nejaká 8-bitová premenná je nastavená na hodnotu „00101101“, môžeme ju zapísať ako „2D“ (čo je číslo 45 desiatkovo). Takýto zápis je kratší a prehľadnejší ako zápis v dvojkovej sústave, pričom však prevod medzi dvojkovou a šestnástkovou sústavou je rýchly a jednoduchý.