001 - programando em python - sistemas de numeração
TRANSCRIPT
![Page 1: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/1.jpg)
MAB 124 Sistemas de Numeração PRC
Sistemas de Numeração
![Page 2: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/2.jpg)
MAB 124 Sistemas de Numeração PRC
Por que Binário?
• Primeiros computadores projetados eram decimais– Mark I e ENIAC
• John von Neumann propôs processamento com dados binários (1945)– Simplificava o projeto de computadores
– Usado tanto por instruções como
por dados
• Relação natural entre comutadores
on/off e cálculos com lógica BooleanaOn Off
Verdadeiro Falso
Sim Não
1 0
![Page 3: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/3.jpg)
MAB 124 Sistemas de Numeração PRC
Contagem e Aritmética
• Decimal ou sistema de base 10– Origem: contando nos dedos– “Dígito” vem do Latim digitus, que significa “dedo”
• Base: o número de dígitos diferentes no sistema numérico, incluindo zero
• Decimal ou base 10: 10 dígitos, 0 até 9• Binário ou base 2: 2 dígitos, 0 e 1
– Bit (dígito binário)• Octal ou base 8: 8 dígitos, 0 até 7• Hexadecimal ou base 16: 16 dígitos, 0 até F
– Exemplos: 1010 = A16; 1110 = B16
![Page 4: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/4.jpg)
MAB 124 Sistemas de Numeração PRC
Considerando os Bits
• Bits são normalmente armazenados e manipulados em grupos– 8 bits = 1 byte– 4 bytes = 1 palavra (em sistemas de 32 bits)
• Número de bits usados em cálculos– Afetam a precisão dos resultados– Limitam o tamanho dos números manipulados
pelo computador
![Page 5: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/5.jpg)
MAB 124 Sistemas de Numeração PRC
Números: Representação Física
• Diferentes numerais, mesmo número de laranjas– Homem das cavernas: IIIII– Romano: V– Arábico: 5
• Diferentes bases, mesmo número de laranjas – 510
– 1012
– 123
![Page 6: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/6.jpg)
MAB 124 Sistemas de Numeração PRC
Sistemas de Numeração
• Romanos: independentes da posição• Moderno: baseado na notação posicional (valor
posicional)– Decimal: sistema de notação posicional baseado em
potências de 10. – Binário: sistema de notação posicional baseado
potências de 2– Octal : sistema de notação posicional baseado em
potências de 8– Hexadecimal: sistema de notação posicional baseado
em potências de 16
![Page 7: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/7.jpg)
MAB 124 Sistemas de Numeração PRC
Sistemas Numéricos mais Comuns
Sistema Base Símbolos
Usado por humanos?
Usado por computadores?
Decimal 10 0, 1, … 9 Sim Não
Binário 2 0, 1 Não Sim
Octal 8 0, 1, … 7 Não Não
Hexa-decimal
16 0, 1, … 9,
A, B, … F
Não Não
![Page 8: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/8.jpg)
MAB 124 Sistemas de Numeração PRC
Quantidades / Contagem (1 de 3)
Decimal Binário Octal
Hexa-decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
![Page 9: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/9.jpg)
MAB 124 Sistemas de Numeração PRC
Quantidades / Contagem (2 de 3)
Decimal Binário Octal
Hexa-decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
![Page 10: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/10.jpg)
MAB 124 Sistemas de Numeração PRC
Quantidades / Contagem (3 de 3)
Decimal Binário Octal
Hexa-decimal
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
21 10101 25 15
22 10110 26 16
23 10111 27 17 Etc.
![Page 11: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/11.jpg)
MAB 124 Sistemas de Numeração PRC
Conversão Entre Bases
• Possibilidades:
Hexadecimal
Decimal Octal
Binário
![Page 12: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/12.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
2510 = 110012 = 318 = 1916
Base
![Page 13: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/13.jpg)
MAB 124 Sistemas de Numeração PRC
Decimal para Decimal (só para entender)
Hexadecimal
Decimal Octal
Binário
![Page 14: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/14.jpg)
MAB 124 Sistemas de Numeração PRC
12510 => 5 x 100 = 52 x 101 = 201 x 102 = 100
125
Base
Peso
![Page 15: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/15.jpg)
MAB 124 Sistemas de Numeração PRC
Binário para Decimal
Hexadecimal
Decimal Octal
Binário
![Page 16: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/16.jpg)
MAB 124 Sistemas de Numeração PRC
Binário para Decimal
• Técnica– Multiplique cada bit por 2n, onde n é o “peso”
do bit– O peso é a posição do bit, começando em 0 à
direita– Adicione os resultados
![Page 17: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/17.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
1010112 => 1 x 20 = 11 x 21 = 20 x 22 = 01 x 23 = 80 x 24 = 01 x 25 = 32
4310
Bit “0”
![Page 18: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/18.jpg)
MAB 124 Sistemas de Numeração PRC
Octal para Decimal
Hexadecimal
Decimal Octal
Binário
![Page 19: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/19.jpg)
MAB 124 Sistemas de Numeração PRC
Octal para Decimal
• Técnica– Multiplique cada bit por 8n, onde n é o “peso”
do bit– O peso é a posição do bit, começando em 0 à
direita– Adicione os resultados
![Page 20: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/20.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
7248 => 4 x 80 = 42 x 81 = 167 x 82 = 448
46810
![Page 21: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/21.jpg)
MAB 124 Sistemas de Numeração PRC
Hexadecimal para Decimal
Hexadecimal
Decimal Octal
Binário
![Page 22: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/22.jpg)
MAB 124 Sistemas de Numeração PRC
Hexadecimal para Decimal
• Técnica– Multiplique cada bit por 16n, onde n é o “peso”
do bit– O peso é a posição do bit, começando de 0 à
direita– Adicione os resultados
![Page 23: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/23.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
ABC16 => C x 160 = 12 x 1 = 12 B x 161 = 11 x 16 = 176 A x 162 = 10 x 256 = 2560
274810
![Page 24: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/24.jpg)
MAB 124 Sistemas de Numeração PRC
Decimal para Binário
Hexadecimal
Decimal Octal
Binário
![Page 25: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/25.jpg)
MAB 124 Sistemas de Numeração PRC
Decimal para Binário
• Técnica– Divida por dois, guardando os restos – Primeiro resto é o bit 0 (bit menos
significativo)– Segundo resto é o bit 1– Etc.
![Page 26: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/26.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
12510 = ?22 125 62 12 31 02 15 12 7 12 3 12 1 12 0 1
12510 = 11111012
![Page 27: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/27.jpg)
MAB 124 Sistemas de Numeração PRC
Octal para Binário
Hexadecimal
Decimal Octal
Binário
![Page 28: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/28.jpg)
MAB 124 Sistemas de Numeração PRC
Octal para Binário
• Técnica– Converta cada dígito octal para uma
representação binária equivalente de 3 bits
![Page 29: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/29.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
7058 = ?2
7 0 5
111 000 101
7058 = 1110001012
![Page 30: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/30.jpg)
MAB 124 Sistemas de Numeração PRC
Hexadecimal para Binário
Hexadecimal
Decimal Octal
Binário
![Page 31: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/31.jpg)
MAB 124 Sistemas de Numeração PRC
Hexadecimal para Binário
• Técnica– Converta cada dígito hexadecimal para uma
representação binária equivalente de 4 bits.
![Page 32: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/32.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
10AF16 = ?2
1 0 A F
0001 0000 1010 1111
10AF16 = 00010000101011112
![Page 33: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/33.jpg)
MAB 124 Sistemas de Numeração PRC
Decimal para Octal
Hexadecimal
Decimal Octal
Binário
![Page 34: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/34.jpg)
MAB 124 Sistemas de Numeração PRC
Decimal para Octal
• Técnica– Divida por 8– Guarde os restos
![Page 35: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/35.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
123410 = ?8
8 1234 154 28 19 28 2 38 0 2
123410 = 23228
![Page 36: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/36.jpg)
MAB 124 Sistemas de Numeração PRC
Decimal para Hexadecimal
Hexadecimal
Decimal Octal
Binário
![Page 37: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/37.jpg)
MAB 124 Sistemas de Numeração PRC
Decimal para Hexadecimal
• Técnica– Divida por 16– Guarde os restos
![Page 38: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/38.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
123410 = ?16
123410 = 4D216
16 1234 77 2
16 4 13 = D16 0 4
![Page 39: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/39.jpg)
MAB 124 Sistemas de Numeração PRC
Binário para Octal
Hexadecimal
Decimal Octal
Binário
![Page 40: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/40.jpg)
MAB 124 Sistemas de Numeração PRC
Binário para Octal
• Técnica– Divida os bits em grupos de três, começando à
direita– Converta para dígitos octais
![Page 41: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/41.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
10110101112 = ?8
1 011 010 111
1 3 2 7
10110101112 = 13278
![Page 42: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/42.jpg)
MAB 124 Sistemas de Numeração PRC
Binário para Hexadecimal
Hexadecimal
Decimal Octal
Binário
![Page 43: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/43.jpg)
MAB 124 Sistemas de Numeração PRC
Binário para Hexadecimal
• Técnica– Divida os bits em grupos de quatro, começando
à direita– Converta para dígitos hexadecimais
![Page 44: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/44.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
10101110112 = ?16
10 1011 1011
2 B B
10101110112 = 2BB16
![Page 45: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/45.jpg)
MAB 124 Sistemas de Numeração PRC
Octal para Hexadecimal
Hexadecimal
Decimal Octal
Binário
![Page 46: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/46.jpg)
MAB 124 Sistemas de Numeração PRC
Octal para Hexadecimal
• Técnica– Use Binário como uma representação
intermediária
![Page 47: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/47.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
10768 = ?16
1 0 7 6
001 000 111 110
2 3 E
10768 = 23E16
![Page 48: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/48.jpg)
MAB 124 Sistemas de Numeração PRC
Hexadecimal para Octal
Hexadecimal
Decimal Octal
Binário
![Page 49: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/49.jpg)
MAB 124 Sistemas de Numeração PRC
Hexadecimal para Octal
• Técnica– Use Binário como uma representação
intermediária
![Page 50: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/50.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
1F0C16 = ?8
1 F 0 C
0001 1111 0000 1100
1 7 4 1 4
1F0C16 = 174148
![Page 51: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/51.jpg)
MAB 124 Sistemas de Numeração PRC
Exercício – Converta ...
Decimal Binário Octal
Hexa-decimal
33
1110101
703
1AF
Pule a resposta Resposta
Não use calculadora!
![Page 52: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/52.jpg)
MAB 124 Sistemas de Numeração PRC
Exercício – Converta …
Decimal Binário Octal
Hexa-decimal
33 100001 41 21
117 1110101 165 75
451 111000011 703 1C3
431 110101111 657 1AF
Resposta
![Page 53: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/53.jpg)
MAB 124 Sistemas de Numeração PRC
Potências mais Comuns (1 de 2)
• Base 10Potência Prefixo Símbolo
10-12 pico p
10-9 nano n
10-6 micro
10-3 mili m
103 kilo k
106 mega M
109 giga G
1012 tera T
Valor
.000000000001
.000000001
.000001
.001
1000
1000000
1000000000
1000000000000
![Page 54: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/54.jpg)
MAB 124 Sistemas de Numeração PRC
Potências mais Comuns (2 de 2)
• Base 2Potência Prefixo Símbolo
210 kilo k
220 mega M
230 Giga G
Valor
1024
1048576
1073741824
• O que são os valores de “k”, “M”, e “G”?• Em computação, em particular com memórias, a interpretação de base-2 geralmente se aplica
![Page 55: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/55.jpg)
MAB 124 Sistemas de Numeração PRC
Exemplo
/ 230 =
No laboratório…1. Clique duplo em Meu Computador2. Clique com o botão direito em C:3. Clique em Propriedades
![Page 56: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/56.jpg)
MAB 124 Sistemas de Numeração PRC
Exercício – Espaço Livre
• Determine o “espaço livre” de todos os drives de um computador do laboratório
Drive
Espaço Livre
Bytes GB
A:
C:
D:
E:
etc.
![Page 57: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/57.jpg)
MAB 124 Sistemas de Numeração PRC
Revisão – multiplicando potências
• Para bases comuns, adicione os expoentes
26 210 = 216 = 65,536
ou …
26 210 = 64 210 = 64k
ab ac = ab+c
![Page 58: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/58.jpg)
MAB 124 Sistemas de Numeração PRC
Adição Binária (1 de 2)
• Dois valores de 1-bit
A B A + B
0 0 0
0 1 1
1 0 1
1 1 10“dois”
![Page 59: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/59.jpg)
MAB 124 Sistemas de Numeração PRC
Adição Binária (2 de 2)
• Dois valores de n-bits– Adicione os bits individualmente– Propague as sobras– E.g.,
10101 21+ 11001 + 25 101110 46
11
![Page 60: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/60.jpg)
MAB 124 Sistemas de Numeração PRC
Multiplicação (1 de 3)
• Decimal (só para entender)
35x 105 175 000 35 3675
![Page 61: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/61.jpg)
MAB 124 Sistemas de Numeração PRC
Multiplicação (2 de 3)
• Binário, dois valores de 1-bit
A B A B
0 0 0
0 1 0
1 0 0
1 1 1
![Page 62: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/62.jpg)
MAB 124 Sistemas de Numeração PRC
Multiplicação (3 de 3)
• Binário, dois valores de n-bits– Como no caso de valores decimais– E.g.,
1110 x 1011 1110 1110 0000 111010011010
![Page 63: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/63.jpg)
MAB 124 Sistemas de Numeração PRC
Frações
• Decimal para decimal (só para entender)
3.14 => 4 x 10-2 = 0.041 x 10-1 = 0.1
3 x 100 = 3 3.14
![Page 64: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/64.jpg)
MAB 124 Sistemas de Numeração PRC
Frações
• Binário para decimal
10.1011 => 1 x 2-4 = 0.06251 x 2-3 = 0.1250 x 2-2 = 0.01 x 2-1 = 0.50 x 20 = 0.01 x 21 = 2.0 2.6875
![Page 65: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/65.jpg)
MAB 124 Sistemas de Numeração PRC
Frações
• Decimal para Binário
3.14579
.14579x 20.29158x 20.58316x 21.16632x 20.33264x 20.66528x 21.33056
etc.11.001001...
![Page 66: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/66.jpg)
MAB 124 Sistemas de Numeração PRC
Exercício – Converta ...
Decimal Binário Octal
Hexa-decimal
29.8
101.1101
3.07
C.82
Pule a resposta Resposta
Não use calculadora!
![Page 67: 001 - Programando em Python - Sistemas de Numeração](https://reader033.vdocuments.pub/reader033/viewer/2022052311/5571f8f949795991698e81a9/html5/thumbnails/67.jpg)
MAB 124 Sistemas de Numeração PRC
Exercício – Converta …
Decimal Binário Octal
Hexa-decimal
29.8 11101.110011… 35.63… 1D.CC…
5.8125 101.1101 5.64 5.D
3.109375 11.000111 3.07 3.1C
12.5078125 1100.10000010 14.404 C.82
Resposta