Docsity
Docsity

Prepara i tuoi esami
Prepara i tuoi esami

Studia grazie alle numerose risorse presenti su Docsity


Ottieni i punti per scaricare
Ottieni i punti per scaricare

Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium


Guide e consigli
Guide e consigli


Introduzione ai Sistemi Numerici e alla Codifica Binaria, Slide di Elementi di Informatica

Theory part 1 for computer science in polytechnic university of Turin 1st year of been taught for python

Tipologia: Slide

2020/2021

Caricato il 20/02/2021

alicia-xhokaxhiu
alicia-xhokaxhiu 🇮🇹

4 documenti

1 / 69

Toggle sidebar

Questa pagina non è visibile nell’anteprima

Non perderti parti importanti!

bg1
Data
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45

Anteprima parziale del testo

Scarica Introduzione ai Sistemi Numerici e alla Codifica Binaria e più Slide in PDF di Elementi di Informatica solo su Docsity!

Data

Numerical data

  • Numerical data is mainly used within scientific context in the modern computers… all the other data types are converted to numerical data to be elaborated
  • Every try for elaborating non numerical data failed or was more inefficient than converting data to numerical data and then elaborate them.

Numeral systems

Non positional:

  • Roman numerals (ex. V, L, D)
  • Arithmetic operations are difficult (ex. V + V = X)

Positional:

  • Arabic (decimal)
  • Mayan (Base 20)

Hybrid

  • Chinese

Positional numbering system in base B

Characteristics:

  • Digits: { 0, 1, 2, ..., B- 1 }
  • Weight of i-th digit: B

i

  • Representation (natural numbers) on N digits i N i i

  a  B

  1 0

A

Binary system

Base = 2 Digits= { 0, 1 } Example: 1012 = 1 × 2 2

  • 0 × 2 1
  • 1 × 2 0 = 1 × 4 + 0 + 1 × 1 = 5 10 111 2
= 1 × 2

2

  • 1 × 2 1
  • 1 × 2 0 = 1 × 4 + 1 × 2 + 1 × 1 = 7 10

Other binary numbers

Terminology

1 0 1 1 0 1 1 0 LSb Least Significant bit MSb Most Significant bit

Some powers of 2

0 = 1 2 11 = 2, 2 1 = 2 2 12 = 4, 2 2 = 4 2 13 = 8, 2 3 = 8 2 14 = 16, 2 4 = 16 2 15 = 32, 2 5 = 32 2 16 = 65, 2 6 = 64 2 17 = 131, 2 7 = 128 2 18 = 262, 2 8 = 256 2 19 = 524, 2 9 = 512 2 20 = 1,048, 2 10 = 1,024 2 30 = 1,073,741,

Binary to decimal conversion

Apply the definition of the weighted sum of the binary numbers: 1101 2 1101 2

= 1 × 2

3

  • 1 × 2 2
  • 0 × 2 1
  • 1 × 2 0 = 8 + 4 + 0 + 1 = 13 10

Decimal to binary conversion

Algorithm for finding the binary representation of a positive integer:

1. Divide by 2 the original value and record the remainder

  1. If the quotient is not zero , continue to divide the new quotient by 2 and record the remainder
  2. Once the quotient equals 0 , the binary value consists of the remainders listed from right to left in the order they were recorded.

13 quotients

remainders

1310 = (^11012)

Limits of the binary system

(natural representation)

bit symbols min

10

max

10 4 16 0 15 8 256 0 255 10 1,024 0 1, 16 65,536 0 65, 32 4,294,967,296 0 4,294,967,

Binary addition

Basic rules : 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 ( carry = 1 )

Binary Subtraction

  • Basic rules: 0 - 0 = 0 0 - 1 = 1 (borrow = 1) 1 - 0 = 1 1 - 1 = 0

Binary Subtraction

The partial subtraction between the bits having the same weight is computed, including the propagation of the borrow: 1 1

  • 0 1 1 0