[inf 140] representacion interna de datos (1 x hoja)

28
Profesores PHM/DCP Pontificia Universidad Católica de Valparaíso Facultad de Ingeniería Escuela de Ingeniería Informática “Representación Interna de Datos” Asignatura INF 140 – Informática I Profesores Pamela Hermosilla Monckton Daniel Cabrera Paniagua

Upload: daniel-barraza-rodriguez

Post on 03-Jul-2015

4.473 views

Category:

Lifestyle


1 download

TRANSCRIPT

Page 1: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Pontificia Universidad Católica de Valparaíso

Facultad de Ingeniería

Escuela de Ingeniería Inform

ática

“Representación Interna de Datos”

Asignatura

INF 140 –

Inform

ática I

Profesores

Pamela Herm

osilla M

onckton

Daniel Cabrera Paniagua

Page 2: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Sistema Binario …

0 & 1

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Representación interna de datos

Page 3: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

En la a

ctu

alid

ad,

y d

esde h

ace y

a m

uch

os a

ños,

el h

om

bre

en s

u v

ida d

iaria s

e

com

unic

a,

alm

acena

info

rma

ció

n

y

la

ad

min

istr

a.

Desd

e

el

punto

de

vis

ta

num

érico c

on e

l sis

tem

a d

ecim

al, y

desde e

l punto

de v

ista

alfabético c

on e

l

idio

ma.

Este

es

el

motivo

que

nos

oblig

a

a

transfo

rmar

inte

rnam

ente

to

dos n

uestr

os dato

s,

tanto

num

éricos

com

o

alfa

num

éricos,

a

una

re

pre

se

nta

ció

n

bin

ari

a

para

qu

e la m

áquin

a s

ea c

ap

az d

e p

rocesarl

os.

Asim

ism

o,

el

com

puta

dor,

d

ebid

o a su co

nstr

ucció

n

basad

a

funda

menta

lme

nte

en

circuitos

ele

ctr

ónic

os

dig

ita

les,

lo h

ace d

esd

e a

mb

os p

unto

s d

e v

ista

con e

l

sistema binario

.

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Representación interna de datos (Introducción)

Page 4: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

El sistema b

inario

es e

l sis

tem

a d

e n

um

era

ció

n q

ue u

tiliz

an i

nte

rnam

ente

los c

ircuitos d

igitale

s d

e c

om

puta

dore

s y

eq

uip

os e

lectr

ón

icos e

n g

en

era

l.

La b

ase o

la c

antida

d d

e s

ímbolo

s q

ue u

tiliz

a e

ste

sis

tem

a e

s d

os,

sie

ndo

esto

s s

ímbolo

s los s

iguie

nte

s:

0 1

Cada c

ifra

o d

ígito d

e u

n n

úm

ero

repre

senta

do e

n e

ste

sis

tem

a s

e d

enom

ina

bit

(contr

acció

n d

ebin

ary

dig

it)

Nib

ble

o c

uart

eto

: 4 b

its

Byte

u o

cte

to:

8 b

its

Kilo

byte

(Kb):

1024 b

yte

s(1

02

4 x

8 b

its)

Megab

yte

(Mb):

1024 K

b(1

02

42

x 8

bits)

Gig

ab

yte

(Gb):

1024 M

b(1

02

43

x 8

bits)

Tera

byte

(Tb):

1024 G

b(1

024

4x 8

bits)

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Sistema Binario

Page 5: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

La base o nú

mero

de

sím

bolo

s q

ue utiliz

a el sistema octal

es och

o,

sie

nd

o s

us s

ímbolo

s los s

igu

iente

s:

0 1 2 3 4 5 6 7

Base 3

:

0,

1, 2.

Base 7

:

0,

1, 2,

3,

4,

5,

6.

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Representación interna de datos (Otras bases)

Page 6: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

24

110

202

10100

20

23

103

201

10011

19

22

102

200

10010

18

21

101

122

10001

17

20

100

121

10000

16

17

33

120

1111

15

16

32

112

1110

14

15

31

111

1101

13

14

30

110

1100

12

13

23

102

1011

11

12

22

101

1010

10

11

21

100

1001

9

10

20

22

1000

8

713

21

111

7

612

20

110

6

511

12

101

5

410

11

100

4

33

10

11

3

22

210

2

11

11

1

00

00

0

b 8

b 4

b 3

b 2

b10

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Representación interna

de datos

Tab

la d

e e

qu

iva

lencia

s

entr

e d

ivers

as b

ases

Page 7: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Repre

senta

r u

n n

úm

ero

decim

al en b

ase b

.

13(1

0)

a b

ase 2

13:2

=6

6:2

=3 3:2

=1

1:2

=0

1101

1

0

1

1

253(1

0)

a b

ase

5 …

25’3

:5=

50

50

:5=

10

10:5

=2 2

:5=

0

2003

03

0

0

2

3

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Conversión Decim

al-Base b

Page 8: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

n

dn

dn-1

…d

2d

1d

0(b

) �

num

(10)

= ∑

di*

bi

i=0

1101 (

2)

1*2

0+

0*2

1+

1*2

2+

1*2

3=

1*1

+ 0

*2 +

1*4

+ 1

*8

1+

0

+

4

+

8

=

13(1

0)

2003 (

5)

3*5

0+

0*5

1+

0*5

2+

2*5

3=

3*1

+

0

+ 0

+

2 *

125 =

3 +

250 =

253(1

0)

253 (

8)

3*8

0+

5*8

1+

2*8

2=

3*1

+

5 *

8

+ 2

* 6

4 =

3 +

40 +

128

= 1

71 (

10)

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Conversión Base b-Decim

al

Convert

ir u

n n

úm

ero

en b

ase

b a

un n

úm

ero

en b

ase d

ecim

al.

Page 9: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Suma Binaria

Tabla

del 0

Tabla

del 1

0 +

0 =

0

0 +

1 =

1

1 +

0 =

1

1 +

1 =

10

1 1 0 0 1

+ 1 0 0 1 1

1 0 1 1 0 0

25

+ 19

44

1 0 1 1 1 0

+ 1 1 1 0

1 1 1 1 0 0

46

+ 14

60

Resta Binaria

Tabla

del 0

Tabla

del 1

0 –

0 =

0

0 –

1 =

no

1 –

0 =

1

1 –

1 =

0

1 1 1 1 1 1

-1 0 1 0 1 0

0 1 0 1 0 1

63

-42

21

1 1 1 1 0 0

-1 0 1 0 1 0

0 1 0 0 1 0

60

-42

18

10100

20

10011

19

10010

18

10001

17

10000

16

1111

15

1110

14

1101

13

1100

12

1011

11

1010

10

1001

9

1000

8

111

7

110

6

101

5

100

4

11

3

10

2

11

00

b2

b10

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Sistema Binario (Operatoria)

Page 10: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Multiplicación Binaria

Tabla

del 0

Tabla

del 1

0 x

0 =

0

0 x

1 =

0

1 x

0 =

0

1 x

1 =

1

1 1 0 1 0 1

x 0 0 1 1 0 1

1 1 0 1 0 1

0 0 0 0 0 0

1 1 0 1 0 1

1 1 0 1 0 1

1 0 1 0 1 1 0 0 0 1

53

x 13

689

División Binaria

1 0 0 0 1 0

1 1 0

1 0 1 0

1 1 0

1 0 0

1 1 0

1 0 1

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

10100

20

10011

19

10010

18

10001

17

10000

16

1111

15

1110

14

1101

13

1100

12

1011

11

1010

10

1001

9

1000

8

111

7

110

6

101

5

100

4

11

3

10

2

11

00

b2

b10

Cociente

Resto

Dividendo

Divisor

Sistema Binario (Operatoria)

Page 11: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

La b

ase o

núm

ero

de s

ímbolo

s q

ue u

tiliz

a e

ste

sis

tem

a e

s 8

, sie

ndo é

sto

s los

sig

uie

nte

s:

0 1 2 3 4 5 6 7

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Sistema Octal

Page 12: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Suma Octal

3 7 1 2 (8)

+ 1 4 4(8)

4 0 5 6 (8)

1994 (10)

+ 100(10)

2094 (10)

Resta Octal

3 7 1 2

-1 4 4

3 5 4 6

1994

-100

1894

24

20

23

19

22

18

21

17

20

16

17

15

16

14

15

13

14

12

13

11

12

10

11

9

10

8

77

66

55

44

33

22

11

00

b8

b10

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Sistema Octal (Operatoria)

Page 13: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

7 6 4

x 3

2 7 3 4

500

x 3

1500

2 7 3 4

2 5 2 3

2 2 1 4

1 4 0

3

7 6 4

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

24

20

23

19

22

18

21

17

20

16

17

15

16

14

15

13

14

12

13

11

12

10

11

9

10

8

77

66

55

44

33

22

11

00

b8

b10

Sistema Octal (Operatoria)

Multiplicación Octal

División Octal

Page 14: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

La b

ase o

mero

de

sím

bolo

s q

ue u

tiliz

a e

ste

sis

tem

a e

s 1

6,

sie

ndo é

sto

s l

os

sig

uie

nte

s:

0 1 2 3 4 5 6 7 8 9 A(10) B(11) C(12) D(13) E(14) F(15)

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Sistema Hexadecim

al

Page 15: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Suma Hexadecimal

1 F 4

+ 1 F 4

3 E 8

500

+ 500

1000

Resta Hexadecimal

3 E 8

-1 F 4

1 F 4

1000

-500

500

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Sistema Hexadecim

al(Operatoria)

Page 16: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Multiplicación Hexadecimal

División Hexadecimal

2 D F

2 A 3 F

3 F 0

1 5

2 3

2 8

x 1 3

7 8

2 8

2 F 8

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Sistema Hexadecim

al(Operatoria)

Page 17: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Conversión decimal-binario

10:2=5 5:2=2 2:2=1 1:2=0

0 1 0 1

10(10)= 1010(2)

Conversión binario-decimal

13(10)= 1101(2)

1 1 0 1 1 x 20= 1

0 x 21= 0

1 x 22= 4

1 x 23= 8

13

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Conversión entre Sistemas Numéricos

Page 18: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Conversión decimal-octal

500(10)= 764(8)

Conversión octal-decimal

764(8)= 500(10)

7 6 4

4 x 80= 4

6 x 81= 48

7 x 82= 448

500

500:8=62 62:8=7 7:8=0

48

56

0

20 6 7

16 4

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Conversión entre Sistemas Numéricos

Page 19: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Conversión decimal-hexadecimal

1000(10)= 3E8(16)

Conversión hexadecimal-decimal

3E8(16)= 1000(10)

3 E 8

8 x 160= 8

E(14) x 161= 224

3 x 162= 768

1000

1000:16=62 62:16=3 3:16=0

96

48

0

40 14 3

32 8

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Conversión entre Sistemas Numéricos

Page 20: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Conversión hexadecimal-binario-hexadecimal 2BC(16)= 1010111100(2)

Conversión binario-octal-binario

0 0 1 0 1 0 1 1 1 1 0 0

2

B

C

0 0 1

1

0 1 0

2

1 1 1

7

1 0 0

4

1274(8)= 1010111100(2)

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Conversión entre Sistemas Numéricos

Page 21: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Conversión hexadecimal-octal-hexadecimal 144(8)=1100100(2)= 64(16)

0 0 1

1

1 0 0

4

1 0 0

4

4

6

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Conversión entre Sistemas Numéricos

Page 22: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Los

com

po

ne

nte

s

dig

ita

les

utiliz

an

cuatr

o

méto

dos

para

la

re

pre

se

nta

ció

n

inte

rna d

e n

úm

ero

s e

nte

ros (

positiv

os y

neg

ativos).

Módulo

y s

ign

o (

MS

)

Com

ple

mento

a 1

(C-1

)

Com

ple

mento

a 2

(C-2

)

Exceso a

2n

-1

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Representación de Números Enteros

Page 23: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Indepe

ndie

nte

del m

éto

do u

tiliz

ado,

en p

rim

er

lugar

se d

eb

e d

efinir N

, es d

ecir,

el núm

ero

de b

its s

obre

el qu

e s

e r

epre

senta

ráel núm

ero

de

seado.

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Representación de Números Enteros

Page 24: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

0 0 0 1 0 1 0

0

Módulo

Sig

no +

0 0 0 1 0 1 0

1

Módulo

Sig

no -

Núm

ero

10

Núm

ero

-1

0

El prim

er

bit

es p

ara

el sig

no

+ �

0

&

-�

1

En e

l re

sto

de los n

-1 b

its v

a e

l m

ódulo

o v

alo

r absolu

to d

el núm

ero

que e

stá

sie

nd

o r

epre

se

nta

do.

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Módulo y Signo (MS)

Page 25: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

0 0 0 1 0 1 0

0

Módulo

Sig

no +

1 1 1 0 1 0 1

1

Módulo

Sig

no -

Núm

ero

10

Núm

ero

-1

0

El prim

er

bit

es p

ara

el sig

no

+ �

0

&

-�

1

Si el núm

ero

es p

ositiv

o,

en los n

-1 b

its r

esta

nte

s v

a e

l m

ódulo

o v

alo

r ab

solu

to

igua

l que e

n M

S.

Si el núm

ero

es n

egativo,

va e

l com

ple

mento

del positiv

o d

el núm

ero

que e

stá

sie

nd

o r

epre

se

nta

do.

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Complemento a 1 (C-1)

Page 26: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

0 0 0 1 0 1 0

0

Módulo

Sig

no +

1 1 1 0 1 0 1

+ 1

1 1 1 0 1 1 0

1

Módulo

Sig

no -

Núm

ero

10

Núm

ero

-1

0

El prim

er

bit

es p

ara

el sig

no

+ �

0

&

-�

1

Si el núm

ero

es p

ositiv

o,

en los n

-1 b

its r

esta

nte

s v

a e

l m

ódulo

o v

alo

r ab

solu

to

igua

l que e

n M

S y

C-1

.

Si el núm

ero

es n

egativo,

va e

l com

ple

mento

del positiv

o d

el núm

ero

que e

stá

sie

nd

o r

epre

se

nta

do +

1 (

sum

a b

inari

a).

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Complemento a 2 (C-2)

Page 27: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Exceso a 2

n-1

1 0 0 0 1 0 1 0

Por

eje

mplo

, para

n=

8 b

its e

l exceso e

s d

e 2

8-1

=128,

con l

o c

ual

el

mero

10

esta

ráre

pre

se

nta

do p

or

10 +

128 =

138 (

eq

uiv

ale

nte

en b

inario),

para

el caso d

el

núm

ero

-1

0 s

e t

endra

-10 +

12

8 =

118 (

equiv

ale

nte

en b

inari

o).

Núm

ero

10

0 1 1 1 0 1 1 0

Núm

ero

-1

0

Dado N

, se d

ete

rmin

a e

l e

xce

so c

orr

espo

ndie

nte

, y q

ue e

stá

dado p

or

2n

-1.

A t

odo n

úm

ero

(positiv

o o

ne

gativo)

se le s

um

a e

l e

xceso,

y e

so e

s lo q

ue

se

escribe e

n b

ina

rio.

INF 140 –Inform

ática I

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

Page 28: [Inf 140] Representacion Interna De Datos (1 X Hoja)

Pro

fesore

s

PH

M/D

CP

Fin

Pontificia Universidad Católica de Valparaíso

Escuela de Ingeniería Inform

ática

INF 140 –Inform

ática I

“Representación Interna de Datos”