Download presentation
Presentation is loading. Please wait.
Published byGodwin Ramsey Modified over 9 years ago
2
Method of representing or encoding numbers Two main notation types Sign-value Roman numerals Positional (place-value) Modern decimal notation Several number systems are commonly used in computing Decimal Binary Hexadecimal “Shorthand” for binary Digital Data2
3
We count in “decimal” or base 10 by powers of 10: 10 0 = 1 10 1 = 10 10 2 = 10*10 = 100 10 3 = 10*10*10 = 1,000 10 6 = 1,000,000 Computers count in “binary” or base 2: 2 0 = 1 2 1 = 2 2 2 = 2*2 = 4 2 3 = 2*2*2 = 8 2 10 = 1,024 Digital Data3
4
Bit (b): bi nary digi t -- 0 or 1 value 0 or 1 correspond to the electrical values of off or on, respectively All computer data is represented in bits Byte (B): grouping of 8 bits Considered the basic unit of digital information 8 bits = 1 byte is the de facto standard (also called an octet ) File sizes and network data are measured in bytes You can’t have a 5-bit file Physical network media transmit bits, but network protocols are based on bytes Unit multiples Kilobyte: 2 10 = 1,024 bytes (≈ 1,000) Megabyte: 2 20 = 1,048,576 bytes (≈ 1,000,000) Gigabyte: 2 30 = 1,073,741,824 bytes (≈ 1,000,000,000) Terabyte: 2 40 = 1,099,511,627,776 bytes (≈ 1,000,000,000,000) Digital Data4
5
Decimal Binary Hexadecimal Digit Position ( k ) 3210 Weight (b k ) 10 3 10 2 10 1 10 0 Decimal Weight1,000100101 Digit (a k ) 1983 Decimal Value 1,000900803 = 1,983 Digit Position ( k ) 109876543210 Weight (b k ) 2 10 2929 2828 2727 2626 2525 2424 23232 2121 2020 Decimal Weight1,0245122561286432168421 Digit (a k ) 11110 111111 Decimal Value 1,024512256128 0 3216 84 2 1 = 1,983 Digit Position ( k ) 210 Weight (b k ) 16 2 16 1 16 0 Decimal Weight256161 Digit (a k ) 7BF Decimal Value 1,79217615= 1,983 Digital Data5
6
Base Number around which system is organized Number of symbols used to represent each digit of a number Digits Set of symbols used in forming numbers Additional symbols may be defined for bases > 10 Ex: hexadecimal (see chart at right) Positional Notation Position of a digit conveys its significance Rightmost digit represents the zero- power of the base value Moving left, each digit represents an increasing power of the base number Number SystemBaseDigits Decimal 100,1,…, 9 Binary 20, 1 Hexadecimal 160, 1,…, 9, A – F Digit Position Number System 43210 Decimal 10 4 10,000 10 3 1,000 10 2 100 10 1 10 10 0 1 Binary 2 4 16 2382382 224224 212212 201201 Hexadecimal 16 4 65,536 16 3 4,096 16 2 256 16 1 16 16 0 1 Digital Data6
7
Hexadecimal: A shorthand notation for binary One hex digit represents 4 binary digits Hexadecimal numbers are usually prefixed with “0x” to identify number it is a hex value 7BF 16 → 0x7BF Digital Data7 DecimalBinaryHex 000000 100011 200102 300113 401004 501015 601106 701117 DecimalBinaryHex 810008 910019 101010A 111011B 121100C 131101D 141110E 151111F
8
1. Divide the value by the given base x The remainder will be the least significant (right- most) digit of the base x number 2. Divide the result by the base The remainder becomes the most significant (left- most) digit of the base x number 3. Repeat step 2 until the result is zero The remainder is the most significant digit of the base x number Digital Data8
9
Convert the decimal value 150 to binary What decimal value does the bit pattern 1 1 0 1 0 0 1 0 0 Convert the binary pattern 1 0 0 1 0 1 1 1 0 0 0 1 To hex Digital Data9
10
Convert 2017 to binary (base 2) Convert 2017 to hexadecimal (base 16) 7 / 16 =0remainder 7 126 / 16 =7remainder e (14) 2,017 / 16 =126Remainder 1 Digital Data 10 1 / 2 =0remainder 1 3 / 2 =1remainder 1 7 / 2 =3remainder 1 15 / 2 =7remainder 1 31/ 2 =15remainder 1 63 / 2 =31remainder 1 126 / 2 =63remainder 0 252 / 2 =126remainder 0 504 / 2 =252remainder 0 1,008 / 2 =504remainder 0 2,017 / 2 =1,008remainder 1 Binary Digits Left to Right 2017 10 = 11111100001 2 2017 10 = 7e1 16 Hex Digits Left to Right Convert 11111100001 to hex Simple: Break up the Binary number into sets of four bits 0111 1110 0001 Look at Binary-Hex chart 7 e 1
11
American Standard Code for Information Interchange (ASCII) Character-encoding scheme based on the ordering of the English alphabet Maps digital bit pattern and character symbol Includes Printable characters Alphabet, numbers, symbols Graphics characters ■ ┌ ┐ ╔ ╗ Control characters Backspace, tab, line feed, carriage return Many of these characters are non-printable Digital Data11
12
Digital Data12
13
Strings are a sequence of bytes Bytes represent ASCII characters Characters can be represented as Character value: ‘m’ Decimal value: 109 Binary value: 0110 1101 Hexadecimal value: 6d Try entering these URLs in a browser http://google.com http://%67%6f%6f%67%6c%65%2e%63%6f%6d ‘%’ tells the program what follows is a hex value Digital Data13
14
A file is a collection of binary data Format determines the interpretation of bit patterns Specifies the type of data a file contains Text, image, sound, Word, Excel, etc. Example 01010101 01010011 01000001 USA (ASCII text file) (24-bit bitmap) Digital Data14
15
Executable programs are just files Sequence of bytes Computers interpret the byte sequence as instructions Executable file formats Windows – Portable Executable (PE) format .exe,.dll (libraries),.sys (device drivers) UNIX – Executable and Linkable Format (ELF) Also used by UNIX variants Linux, BSD, Solaris Mac OS X – Mach object file (Mach-O) Earlier Mac OSs use Preferred Executable Format (PEF) Digital Data15
16
Convention for naming files . Extension is usually three letters .txt (text),.jpg (JPEG image),.mp3 (MP3 audio),.doc (Word),.xls (Excel) Can be more or less .c (C source code),.gz (GNU zip),.docx (Word),.xlsx (Excel) Extension DOES NOT determine bit interpretation Determined by file format (ie., how file is being viewed) Operating systems and applications make decisions based on file extension .doc *ought* to be a Word document…I should use Microsoft Word to open it Extensions can be changed without changing the file format Example: change.zip to.txt to email a ZIP file Can still open the “.txt” file with a program that recognizes the ZIP file format Digital Data16
17
What string is represented by the ASCII values : 85 83 77 67 What exactly is displayed when we open the file yay.txt in notepad which consists of the following bytes: 1010101 1010011 1001101 1000011 What exactly would be displayed in the hex editor Frhed when we open yay.txt? Digital Data17
18
Number Systems Decoded http://www.globalknowledge.ca/articles/whitepaper detail.asp?wpid=315 RFC 20: ASCII format for Network Interchange http://tools.ietf.org/html/rfc20 File Signatures Table http://www.garykessler.net/library/file_sigs.html Comparison of Executable File Formats http://en.wikipedia.org/wiki/Comparison_of_execut able_file_formats Digital Data18
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.