Sistema de numeração hexadecimal: diferenças entre revisões

Conteúdo apagado Conteúdo adicionado
tudo
Etiquetas: Possível resumo indevido Remoção considerável de conteúdo Editor Visual
m Foram revertidas as edições de 187.112.59.7 para a última revisão de 177.95.143.210, de 17h41min de 30 de março de 2016 (UTC)
Linha 1:
{{Sistemas numéricos}}
 
O '''sistema hexadecimal''' é um [[sistema de numeração]] posicional que representa os números '''em base 16''', portanto empregando 16 símbolos.
 
Está vinculado a [[informática]], pois os [[computador]]es costumam utilizar o [[byte]] ou octeto como unidade básica da [[memória (computador)|memória]]; e, devido a um byte representar <math>2^8 = 256</math> valores possíveis, e isto poder representar-se como <math>2^8 = 2^4 \cdot 2^4 = 16 \cdot 16 = 1 \cdot 16^2 + 0 \cdot 16^1 + 0 \cdot 16^0</math>, o que, segundo o '''teorema geral da numeração posicional''', equivale ao número em base 16 <math>100_{16}</math>, dois dígitos hexadecimais correspondem exactamente —permitem representar a mesma linha de inteiros— a um byte.
 
Ele é muito utilizado para representar números binários de uma forma mais compacta, pois é muito fácil converter binários pra hexadecimal e vice-versa. Dessa forma, esse sistema é bastante utilizado em aplicações de computadores e microprocessadores (programação, impressão e displays).
 
Devido ao [[sistema decimal]] geralmente usado para a numeração apenas dispor de dez símbolos, deve-se incluir seis '''letras''' adicionais para completar o sistema. O conjunto de símbolos fica, portanto, assim:
: <math> S = \{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \mathrm{A}, \mathrm{B}, \mathrm{C}, \mathrm{D}, \mathrm{E}, \mathrm{F}\}</math>
 
== Contagem em Hexadecimal ==
Assim como nos outros sistemas numéricos, após o uso de todos os dígitos hexadecimais, se inicia a repetição com a adição de outro dígito:
(...) 8, 9,A(10), B(11), C(12), D(13), E(14), F(15), ...
Pode parecer pouca a diferença para os números decimais, porém esses 6 dígitos a mais fazem muita diferença. Por exemplo, com dois dígitos, em decimal, é possível fazer 100 combinações diferentes. Em hexadecimal, esse número sobe para 256.
 
== Conversão de Binário para Hexadecimal ==
Um dígito em hexadecimal pode representar um número binário de 4 dígitos, dessa forma, para transformar um binário em hexadecimal, separamos o binário em grupos de 4 bits, começando pela direita.
 
;'''Exemplo:'''
Binário: 1101000101100011.
 
1º - separar em grupos de quatro bits:
<pre>
1101 0001 0110 0011
</pre>
 
2º - identificar os números hexadecimais correspondentes:
 
<pre>
1101 = D
0001 = 1
0110 = 6
0011 = 3
</pre>
 
Hexadecimal: D163.
 
== Conversão de Hexadecimal para Binário ==
É o inverso do processo anterior. Cada digito será transformado em um número binário de 4 bits.
 
;'''Exemplo:'''
<pre>
Hexadecimal: F2A7
 
F = 1111
2 = 0010
A = 1010
7 = 0111
</pre>
 
Binário: 1111001010100111.
 
== Conversão de Decimal para Hexadecimal ==
Ver-se-á um exemplo numérico para obter o valor de uma representação hexadecimal:
3E0,A (16) = 3×16² + E×16<sup>1</sup> + 0×16<sup>0</sup> + A×16<sup>-1</sup> = 3×256 + 14×16 + 0×1 + 10×0,0625 = 992,625
 
Exemplos para obter um número hexadecimal de um número decimal:
Divide-se o número decimal por 16.
85|_16
- 80 5,3125 Pode-se perceber que contém vírgula nesta divisão,porém, utilizaremos
-- apenas o quociente (5) e resto da divisão antes da vírgula (5),
050 Não esquecendo de colocar o quociente primeiro e depois o resto.
- 48 Decimal 85 = 55(hex)
--
020 79|_16 O número 79 também contêm vírgula. Pegamos 4
- 16 - 64 4,9375 e 15 que é igual a F.
-- -- Decimal 79 = 4F(hex)
040 15
- 32 .
-- .
080
- 80
--
0
 
== Adição Hexadecimal ==
É possível realizar adições diretamente com números hexadecimais. Basta lembrar que os dígitos 0-9 equivalem aos mesmos em decimal, e que os dígitos a-f equivalem aos decimais 10-15. Assim como na soma de decimais, devemos começar pela direita.
 
# Realize a soma por colunas, e pense nos valores decimais dos dígitos
# Se a soma dos dígitos for menor que 15 (em decimal), registre o valor (em hexadecimal)
# Se a soma dos dígitos for maior que 15, subtraia 16 do resultado, registre o numero hexadecimal e gere um carry na próxima coluna
 
;'''Exemplo:'''
<math>DF+AC</math>
 
<math>F+C= 15+12= 27</math>
 
<math>27-16=11=B</math>
 
<math>D+A+1(carry)=13+10+1=24</math>
 
<math>24-16=8</math> com carry de 1.
Então: <math>DF+AC= 18B</math>
 
== Tabela de conversão entre hexadecimal, decimal, octal e binário ==
{| border="0" cellspacing="0" cellpadding="0" style="text-align:center;border:2px"
|- style="background:black; height:2px"
| style="background:black; width:2px" | || || || || || || || || || || ||
|-style="background:#f6a07c; 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:#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"|1||style="background:black; width:2px" |
|-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"|1|| style="background:white;width:24px"|0||style="background:black; width:2px" |
|-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"|1|| style="background:red;width:24px"|1||style="background:black; width:2px" |
|- style="background:black; height:2px"
| style="background:black; width:2px" | || || || || || || || || || || ||
|-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"|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: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: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: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; width:2px" | || || || || || || || || || || ||
|-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"|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: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: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: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; width:2px" | || || || || || || || || || || ||
|-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"|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: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: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:#f6a07c; 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"|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; width:2px" | || || || || || || || || || || ||
|}
 
== Fracções ==
As fracções, no seu desenvolvimento hexadecimal, não são exactas a menos que o denominador seja potência de 2. Contudo, os períodos não costumam ser muito complicados.
:1/2 = 0,8
:1/3 = 0,55...
:1/4 = 0,4
:1/5 = 0,33...
:1/6 = 0,2AA...
:1/7 = 0,249249...
:1/8 = 0,2
:1/9 = 0,1C1C...
:1/A = 0,199...
:1/B = 0,1745D1745D...
:1/C = 0,155...
:1/D = 0,13B13B...
:1/E = 0,1249249...
:1/F = 0,11...
 
== Tabela de multiplicação ==
{| class="wikitable" border="1"
|-----
| &nbsp; || '''1'''
| '''2'''
| '''3''' || '''4'''
| '''5'''
| '''6''' || '''7'''
| '''8'''
| '''9''' || '''A'''
| '''B'''
| '''C''' || '''D'''
| '''E'''
| '''F''' || '''10'''
|-----
|1|| 1 || 2 || 3 || 4
| 5 || 6 || 7 || 8 || 9 || A || B || C || D
| E || F || 10
|-----
| '''2''' || 2 || 4 || 6 || 8
| A || C || E || 10 || 12 || 14 || 16 || 18 || 1A
| 1C || 1E || 20
|-----
| '''3''' || 3 || 6 || 9 || C
| F || 12 || 15 || 18 || 1B || 1E || 21
| 24 || 27 || 2A || 2D || 30
|-----
| '''4''' || 4 || 8 || C || 10
| 14 || 18 || 1C || 20 || 24 || 28 || 2C
| 30 || 34 || 38 || 3C || 40
|-----
| '''5''' || 5 || A || F || 14
| 19 || 1E || 23 || 28 || 2D || 32 || 37
| 3C || 41 || 46 || 4B || 50
|-----
| '''6''' || 6 || C || 12 || 18
| 1E || 24 || 2A || 30 || 36 || 3C || 42
| 48 || 4E || 54 || 5A || 60
|-----
| '''7''' || 7 || E || 15 || 1C
| 23 || 2A || 31 || 38 || 3F || 46 || 4D
| 54 || 5B || 62 || 69 || 70
|-----
| '''8''' || 8 || 10 || 18 || 20
| 28 || 30 || 38 || 40 || 48 || 50 || 58
| 60 || 68 || 70 || 78 || 80
|-----
| '''9''' || 9 || 12 || 1B || 24
| 2D || 36 || 3F || 48 || 51 || 5A || 63
| 6C || 75 || 7E || 87 || 90
|-----
| '''A''' || A || 14 || 1E || 28
| 32 || 3C || 46 || 50 || 5A || 64 || 6E
| 78 || 82 || 8C || 96 || A0
|-----
| '''B''' || B || 16 || 21 || 2C
| 37 || 42 || 4E || 58 || 63 || 6E || 79
| 84 || 8F || 9A || A5 || B0
|-----
| '''C''' || C || 18 || 24 || 30
| 3C || 48 || 54 || 60 || 6C || 78 || 84
| 90 || 9C || A8 || B4 || C0
|-----
| '''D''' || D || 1A || 27 || 34
| 41 || 4E || 5B || 68 || 75 || 82 || 8F
| 9C || A9 || B6 || C3 || D0
|-----
| '''E''' || E || 1C || 2A || 38
| 46 || 54 || 62 || 70 || 7E || 8C || 9A
| A8 || B6 || C4 || D2 || E0
|-----
| '''F''' || F || 1E || 2D || 3C
| 4B || 5A || 69 || 78 || 87 || 96 || A5
| B4 || C3 || D2 || E1 || F0
|-----
| '''10''' || 10 || 20 || 30 || 40
| 50 || 60 || 70 || 80 || 90 || A0 || B0
| C0 || D0 || E0 || F0 || 100
|}
 
{{Referências}}
* FLOYD, Thomas L. Sistemas digitais: fundamentos e aplicações. Porto Alegre: Bookman, 2007. 888 p. + 2 CD-ROMs ISBN 9788560031931.
 
== Ver também ==
* [[Editor hexadecimal]]
* [[Sistema binário (matemática)|Sistema binário]]
* [[Sistema decimal]]
* [[Sistema octal]]
* [[Conversão entre sistemas numéricos]]
* [[Anexo:Lista de cores|Lista de cores em hexadecimal]]
 
{{esboço-matemática}}
 
[[Categoria:Sistemas de numeração]]