cpe323NumberRepresentation

# cpe323NumberRepresentation - CPE 323 Data Types and Number...

This preview shows pages 1–3. Sign up to view the full content.

CPE 323 Data Types and Number Representations Aleksandar Milenkovic Numeral Systems: Decimal, binary, hexadecimal, and octal We ordinarily represent numbers using decimal numeral system that has 10 as its base (also base-10 or denary). The decimal numeral system uses 10 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. It is the most widely used numeral system, perhaps because humans have ten fingers over both hands. For example, a decimal number 456 could also be represented as (4 100’s, 5 10’s, and 6 1’s): 456 10 = 4*10 2 + 5*10 1 + 6*10 0 The binary numeral system, or base-2 (radix-2) number system, is a numeral system that represents numeric values using only two symbols, 0 and 1. These symbols can be directly implemented using logic gates and that is why all modern computers internally use the binary system to store information. For example, 10111 2 is a binary number with 5 binary digits. The left-most bit is known as the most significant bit (msb), and the rightmost one is known as the least-significant bit (lsb). This binary number 10111 2 can be converted to a corresponding decimal number as follows: 10101 2 = 1*2 4 + 0*2 3 + 1*2 2 + 1*2 1 + 1*2 0 = 23 10 Hexadecimal (base-16, hexa, or hex) is a numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F (or a through f) to represent values ten to fifteen. For example, a hex number 1A3 16 corresponds to 1A3 16 = 1*16 2 + 10*16 1 + 3*16 0 = 256 + 160 + 3 = 419 10 1A3 16 = 1_1010_0011 2 Its primary use is as a human friendly representation of binary coded values, so it is often used in digital electronics and computer engineering. Since each hexadecimal digit represents four binary digits (bits), it is a compact and easily translated shorthand to express values in base two. Octal (also base-8) is a number system with a radix, or base, of 8. It uses 8 distinct symbols 0, 1, 2, 3, 4, 5, 6, and 7. An octal number 372 8 corresponds to

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
372 8 = 3*8 2 + 7*8 1 + 2*8 0 = 192 + 56 + 2 = 250 10 . Storing and interpreting information in modern computers An n-bit binary number can differentiate between 2 n things. In digital computers information and space are organized in bytes. A byte can represent up to 2 8 = 256 things. 1 byte = 8 binary digits = 8 bits (e.g. 10010011) ½ byte = 1 nibble = 4 bits In 16-bit computers 1 word = 2 bytes (16 bits). In 32-bit computers 1 word = 4 bytes (32 bits), a half-word is 2 bytes (16-bits), and a double word is 8 bytes (64 bits). Meaning of bits and bytes is assigned by the convention . Some examples of common encoding formats are as follows: 1 byte ASCII = one of 256 alphanumeric or special purpose text character (definitions are in the ASCII table, see http://en.wikipedia.org/wiki/ASCII ) 1 byte = 1 short unsigned integer (0 – 255) 1 byte = 1 short signed integer (-128 – 127) 1 byte = 2 Binary coded decimal (BCD) digits (i.e. one per nibble) 1 byte = 2 hexidecimal (hex) digits (one per nibble)
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 12/04/2011 for the course CPE 323 taught by Professor Milenkovic during the Spring '10 term at University of Alabama - Huntsville.

### Page1 / 12

cpe323NumberRepresentation - CPE 323 Data Types and Number...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online