- Data and Numbering System - Conversion Between Numberings

Download Presentation

- Data and Numbering System - Conversion Between Numberings

Loading in 2 Seconds...

- 111 Views
- Uploaded on
- Presentation posted in: General

- Data and Numbering System - Conversion Between Numberings

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

- Data and Numbering System- Conversion Between Numberings

Data

Digitally represented information in a form suitable for communication, interpretation, or processing by human or automatic means.

Data include constants, variables, arrays, and character strings.

Number System

A numbering system is specific notation for representing numbers.

Week 301/27/2005Course ISM3230Dr. Simon Qiu

- Data and Numbering System- Conversion Between Numberings

System Base:

The base represents the number of symbols which are used

in the system:

Ten-base system (Decimal):0, 1, 2, …, 9;

Two-base system (Binary): 0 and 1;

Eight-base system (Octal): 0, 1, 2, …, 8;

16-base (Hex): 0, 1, 2, …, 9, A, B,…,E , F.

Week 301/27/2005Course ISM3230Dr. Simon Qiu

- Number System Conversion -1

Week 301/27/2005Course ISM3230Dr. Simon Qiu

- Number System Conversion -2

- Converting Number to Base 2
2|283 0.5764 *2 = 1.1568 0.1

2|141 | 1 1.1568 *2 0.10

2| 70 | 1 =0.3056 *2 0.100

2|35 | 0 =0.6112 *2 0.1001

2|17 | 1 =1.2224 *2 0.10010

2| 8 | 1 = 0.4448 *2 0.100100

2| 4 | 0 = 0.8896 *2 0.1001001

2 | 2 | 0 = 1.7792 *2 0.10010011

2 | 1 | 0 = 1.5584 *2 0.10010011

2 | 0 | 1 =>100011011 =1.1168

Week 301/27/2005Course ISM3230Dr. Simon Qiu

- Number System Conversion -2

- Converting Number to Base8 (or Base16)
Grouping Method from Bits of Base2 into Base8

(or Base 16)

101,0010,11102<=>52E16;

10,100,101,1102 <=> 24568

Week 301/27/2005Course ISM3230Dr. Simon Qiu

- Binary-Arithmetic Operations

- Binary: Addition/multiplication/division
1011 1101011

+ 1001 101/11110 X 1001

10100 1011001

101 101100

101 1100011

0

Week 301/27/2005Course ISM3230Dr. Simon Qiu

- Binary-Arithmetic Operations

- Negative Number
-8 =1111,111,111,1000 = 0xFFF8

( = - ( 4 + 2 + 1 )

OR –

32768+16384+8192+4096+1024+512+256+128+64+32+16+8 )

Week 301/27/2005Course ISM3230Dr. Simon Qiu

- Binary-Arithmetic Operations

- Subtraction by Complement Addition
1101-1001 => 1101 + (~(1001)) +1 = 1101 + 0110 + 1 = 0100

- Two’s Complement - Representing negative numbers.
The way twos complement works is by

defining the representation for the negative numbers as following:

1 byte: -X = 28 – X; 2 byte: -X = 216 – X; 4 byte: -X = 232 – X

It is almost always easiest to work in Hexadecimal System:

1 byte: -X = 0X100– X; Examples:

2 byte: -X = 0X10000– X; -74 = -0x 4A (Hex) = 0x B6

4 byte: -X = 0X10000000– X-3 = -0x 03 (Hex) = 0x FD

-8 = -0x 0008 (Hex) = 0x FFF8

Week 301/27/2005Course ISM3230Dr. Simon Qiu

- Binary-Arithmetic Operations

- Two’s Complement - Representing negative numbers.
The way twos complement works is by defining the representation for the negative numbers as following:

1 byte: -X = 28 – X;

2 byte: -X = 216 – X;

4 byte: -X = 232 – X

Week 301/27/2005Course ISM3230Dr. Simon Qiu

- Binary-Arithmetic Operations

- It is almost always easiest to work in Hexadecimal System:
1 byte: -X = 0X100– X;

2 byte: -X = 0X10000– X;

4 byte: -X = 0X10000000– X

Examples:

-74 = -0x 4A (Hex) = 0x B6

-3 = -0x 03 (Hex) = 0x FD

-8 = -0x 0008 (Hex) = 0x FFF8

Week 301/27/2005Course ISM3230Dr. Simon Qiu

- Assignments2

1. What are the decimal (base ten) values of

1012 , 2547 , 4F16 , 20A12 ,20A16

2. Convert the following numbers from base 10:

25 to base 2; 103 to base 4; 435 to base 16.

3. Convert the hex number 12EFA to binary

4. Convert the binary number 11110100101101111100 to hexadecimal.

5. What are the twos complement equivalents of the following decimal numbers?

-74 = - 0x_ _ (Hex) = 0x_ _ (two complement)

-128 = - 0x_ _ (Hex) = 0x_ _ (two complement)

-3 = - 0x_ _ _ _ (Hex) = 0x_ _ _ _ (two complement)

Week 301/27/2005Course ISM3230Dr. Simon Qiu