1 / 11

Lecture 02: OCTAL AND HEXADECIMAL NUMBER SYSTEMS

Lecture 02: OCTAL AND HEXADECIMAL NUMBER SYSTEMS. PROF. INDRANIL SENGUPTA DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING. Octal Number System. A compact way to represent binary numbers. Group of three binary digits are represented by a octal digit. Octal digits are 0 to 7.

katiem
Download Presentation

Lecture 02: OCTAL AND HEXADECIMAL NUMBER SYSTEMS

An Image/Link below is provided (as is) to download presentation 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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 02: OCTAL AND HEXADECIMAL NUMBER SYSTEMS PROF. INDRANIL SENGUPTA DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

  2. Octal Number System • A compact way to represent binary numbers. • Group of three binary digits are represented by a octal digit. • Octal digits are 0 to 7.

  3. Binary to Octal Conversion • For the integer part: • Scan the binary number from right to left. • Translate each group of three bits into the corresponding octal digit. • Add leading zeros if necessary. • For the fractional part: • Scan the binary number from left to right. • Translate each group of three bits into the corresponding octal digit. • Add trailing zeros if necessary.

  4. Examples (Binary to Octal) • (101101000011)2 = (5503)8 • (1010100001)2 = (1241)8 • (.1000011)2 = (.414)8 • (11. 0101111)2 = (3.274)8 Two leading 0s are added Two trailing 0s are added A leading 0 and two trailing 0s are added

  5. Octal to Binary Conversion • Translate every octal digit into its 3-bit binary equivalent. • Examples: (1645)8= (001 110 100 101)2 (22.172)8= (010 010 . 001 111 010)2 (1.54)8= (001 . 101 100)2

  6. Hexadecimal Number System • A compact way to represent binary numbers. • Group of four binary digits are represented by a hexadecimal digit. • Hexadecimal digits are 0 to 9, A to F.

  7. Binary to Hexadecimal Conversion • For the integer part: • Scan the binary number from right to left. • Translate each group of four bits into the corresponding hexadecimal digit. • Add leading zeros if necessary. • For the fractional part: • Scan the binary number from left to right. • Translate each group of four bits into the corresponding hexadecimal digit. • Add trailing zeros if necessary.

  8. Examples (Binary to Hexadecimal) • (101101000011)2 = (B43)16 • (1010100001)2 = (2A1)16 • (.1000010)2 = (.84)16 • (101 . 0101111)2 = (5.5E)16 Two leading 0s are added A trailing 0 is added A leading 0 and trailing 0 are added

  9. Hexadecimal to Binary Conversion • Translate every hexadecimal digit into its 4-bit binary equivalent. • Examples: (3A5)16 = (0011 1010 0101)2 (12.3D)16 = (0001 0010 . 0011 1101)2 (1.8)16 = (0001 . 1000)2

  10. Decimal to Radix-r and Vice Versa • We follow a principle similar to decimal-binary and binary-decimal conversion as discussed earlier. • Radix-r to decimal: • Multiply each digit by corresponding weight and add them up. • Decimal to radix-r: • For the integer part, repeatedly divide the number by r and accumulate the remainder. Remainders are arranged in reverse order. • For the fractional part, repeatedly multiply by r, and accumulate & discard the integer part. The digits are arranged in the order they are generated.

  11. END OF LECTURE 02

More Related