sistem bilangan dan format data -...

21

Upload: lenhan

Post on 19-Mar-2019

272 views

Category:

Documents


1 download

TRANSCRIPT

Sistem Bilangan dan Format Data

Basis

• Basis suatu sistem bilangan adalah sembarang angka termasuk 0 yang ada dalam suatu sistem bilangan

• Macamnya :• Decimal (basis 10) : 0,1,2,3,4,5,6,7,8,9

• Biner (Basis 2) : 0,1

• Hexadecimal (basis 16) : 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

• Oktal (basis 8) : 0,1,2,3,4,5,6,7

Munculnya Sistem Bilangan

• Sistem bilangan muncul karena komputer melakukan operasi menggunakan suatu bilangan tertentu, yaitu biner.

• Semua kode program dan data disimpan dan dimanipulasi menggunakan sistembiner.

• Masing-masing digit dalam sistem biner disebut bit (binary digit) dan hanya mempunyai dua harga, 0 dan 1

• Bit biasanya disimpan dalam kelompok 8 bit disebut byte

16 bit disebut bye

Misalnya : 1100112 adalah :

• 1x25 + 1x24 + 0x23 + 0x22 + 1x21 + 1x20

Decimal

• Have a base, or radix of 10

• Each digit in the number is multiplied by 10 raised to a powercorresponding to the digit’s position

• Ex :

• 83

• 4728

• 10009

• 0.256

• 10009.1001

Decimal

• 83 = (8 x 101) + (3 x 100)

• 4728 = (4x103) + (7x102) + (2x101) + (8 x 100)

• 10009 = (1x104) + (0x103) + (0x102) +

= (0 x 101) + (9 x 100)

Decimal - Fractions

X = { …d2d1d0.d-1d-2d-3…}

Ex :

0.256 = (2x10-1) + (5x10-2) + (6x10-3)

10009.1001 ???

Binary

• Only 2 digits, 1 and 0

• Numbers in the binary system are represented to the base 2

• Ex :

• 0(2)

• 1(2)

• 0101(2)

• 1010(2)

Binary - Example

• 10(2) = (1 x 21) + (0 x 20)

= 2(10)

• 1111(2) = (1 x 23) + (1 x 22) + (1 x 21) + (1 x 20)

= 23 + 22 + 21 + 20

= 8 + 4 + 2 + 1

= 15(10)

Converting Between Binary and Decimal

• 3(10) = ………..(2)

• 24(10) = ………..(2)

• 255(10) = ………..(2)

Decimal to Binary

3(10) = …(2)

128 64 32 16 8 4 2 1

27 26 25 24 23 22 21 20

Decimal to Binary

3(10) = …(2)

3(10) = 11(2)

128 64 32 16 8 4 2 1

27 26 25 24 23 22 21 20

0 0 0 0 0 0 1 1

Decimal to Binary

24(10) = …(2)

24(10) = 11000(2)

128 64 32 16 8 4 2 1

27 26 25 24 23 22 21 20

0 0 0 1 1 0 0 0

Decimal to Binary

255(10) = …(2)

255(10) = 11111111(2)

128 64 32 16 8 4 2 1

27 26 25 24 23 22 21 20

1 1 1 1 1 1 1 1

Binary to Decimal

• 101(2) = ………..(10)

• 1001(2) = ………..(10)

• 1111(2) = ………..(10)

Binary to Decimal

101(2) = …(10)

1 0 1

Binary to Decimal

101(2) = …(10)

1 0 1

22 21 20

Binary to Decimal

101(2) = …(10)

101(2) = (1x22) + (0x21) + (1x20)

= 4 + 0 + 1

= 5(10)

1 0 1

22 21 20

4 0 1

Hexadecimal

• Binary digits are grouped into sets of four

• Base 16

Ex :

• 2C(16)

• DE2(16)

• A(16)

• AA(16)

• 69F(16)

Hexadecimal to Decimal

2C(16) = …(10)

2C(16) = (2x161) + (12x160)

= 32 + 12

= 44(10)