Presentation is loading. Please wait.

Presentation is loading. Please wait.

Numbers and Number Systems

Similar presentations


Presentation on theme: "Numbers and Number Systems"— Presentation transcript:

1 Numbers and Number Systems
Instructor : Eng. Haya Sammaneh

2 Introduction Real World Data Computer Data Input device Dear Mom:
Keyboard Digital camera

3 Number Systems Decimal -- 10 symbols (0,1,2,3,4,5,6,7,8,9)
Binary -- 2 symbols (0,1) Octal -- 8 symbols (0,1,2,3,4,5,6,7) Hexadecimal symbols (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) , A = 10 , B = 11 ….F = 15

4 Converting with fraction, examples
Binary to Decimal Ex: (1101.1)2  1*23 + 1*22 + 0*21 + 1*20 + 1*2-1 = (13.5)10 Octal to Decimal Ex: (673)8  6* *81 + 3*80 = (443)10 Hexadecimal to Decimal Ex. (A9C)16  A* *161 + C * 160= 10* * * 160 =(2788)10

5 Converting, example Binary to Octal Ex: (011011.101100)2(33.54)8
Binary to Hexadecimal Ex: ( )2(FB.D8)16 Hexadecimal to Binary Ex. (A3.B)16  ( )2

6 Converting, example Decimal to Binary EX: (12.3)10  (1100.01001)2
12 / 2 = 6 ( Remainder 0 (right) ) 6 / 2 = 3 ( Remainder 0 ) 3 / 2 = 1 ( Remainder 1 ) 1 / 2= 0 ( Remainder 1 (left)) 0.3 * 2 = 0.6 (left) 0.6 * 2 = 1.2 0.2 * 2 = 0.4 0.4 * 2 = 0.8 0.8 * 2 = 1.6 (right) Using the same method to convert the Decimal number to any base.

7 Signed Numbers In general a N-bit integer can store numbers in the range of -2N-1 -1 to 2N -1

8 Ways to represent negatives
Negative integers are stored via two’s complement representation 1’s complement reverse the bits to get the negative Ex: 1101  1’s complement  0010 2’s complement It happens by reversing the bits (1’s complement) then adding 1. Ex: 1101  2’s complement  0011 Get 1’s complement  0010 then add 1  0011

9 Binary arithmetic – addition and multiplication
0 + 0 = 0 0 + 1 = 1 Overflow: If there is not enough room to hold the result correctly. If the two numbers are of opposite signs, no overflow can occur. (Why not?) multiplication 0 * 0 = 0 0 * 1 =0 1 * 0 = 0 1 * 1 = 1 1 + 0 = 1 1 + 1 = 0 and carry 1 (Result is smaller than one of them)

10 Concepts of bit, byte and word
Bit is the smallest data item in computers (short for "binary digit" . Each data item, or bit, can assume either the value 0 or the value 1. Computer circuitry performs various simple bit manipulations, such as examining the value of a bit, setting the value of a bit and reversing a bit (from 1 to 0 or from 0 to 1). Bytes are composed of eight bits which is the smallest grouping of numbers . Large amounts of memory are indicated in terms of kilobytes (1,024 bytes), megabytes (1,048,576 bytes), and gigabytes (1,073,741,824 bytes). Words: The size of a word varies from one computer to another, depending on the CPU. For computers with a 16-bit CPU, a word is 16 bits (2 bytes). On large mainframes, a word can be as long as 64 bits (8 bytes) or 128 bit (16 byte). Some computers and programming languages distinguish between short-words and long-words. A short-word is usually 2 bytes long, while a long-word is 4 bytes.

11 Standard Alphanumeric Formats
Problem : Representing text strings, such as “Hello, world”, in a computer The standards for representing letters (alpha) and numbers ASCII – American standard code for information interchange Unicode

12 Character Code :ASCII and Unicode
Why do computers use numbers for the names of letters? Because they store all information in number form. Technical detail: they store information as ‘bytes’; each ‘byte’ consists of 8 ‘bits’; each ‘bit’ is either the number ‘0’ or ‘1’’

13 Character Code :ASCII and Unicode
ASCII and Unicode are two computer ‘languages’ for naming letters The ASCII name for ‘a’ is ‘61’ The Unicode name for ‘a’ is ‘U+0061’

14 ASCII Reference Table Control , Numeric, Alphabetic, Punctuations Codes
MSD LSD 1 2 3 4 5 6 7 NUL DLE SP @ P p SOH DC1 ! A Q a W STX DC2 B R b r ETX DC3 # C S c s EOT DC4 $ D T d t ENQ NAK % E U e u ACJ SYN & F V f v BEL ETB G g w 8 BS CAN ( H X h x 9 HT EM ) I Y i y LF SUB * : J Z j z VT ESC + ; K [ k { FF FS , < L \ l | CR GS - = M ] m } SO RS . > N ^ n ~ SI US / ? O _ o DEL 7416

15 ASCII Most widely used coding scheme
Computer systems can represent up to 256 letters Technical detail: with one 8-bit byte (28 = 256) ASCII only uses 7 bits (27 = 128) The first are called ASCII letters (characters) 1-32: That’s for control characters like the ‘option’ key.

16 ASCII Problem No one agrees on what letters the numbers stand for.

17 Unicode: fixing the ASCII problem
Most common 16-bit form represents 65,536 characters. Multilingual: These characters cover the principal written languages of the Americas, Europe, the Middle East, Africa, India, Asia, and Pacifica.


Download ppt "Numbers and Number Systems"

Similar presentations


Ads by Google