1 / 16

Bits, Data types, and Operations: Chapter 2

1. Bits, Data types, and Operations: Chapter 2. COMP 2610. Dr. James Money COMP 2610. Floating Point Data Type. Most ISAs have a data type called float , which is 32 bits arranged as follows 1 bit for sign 8 bits for range of exponent 23 bits for the precision or fraction

Download Presentation

Bits, Data types, and Operations: Chapter 2

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. 1 Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP 2610

  2. Floating Point Data Type • Most ISAs have a data type called float, which is 32 bits arranged as follows • 1 bit for sign • 8 bits for range of exponent • 23 bits for the precision or fraction • This is called the IEEE Standard for Floating Point Arithmetic

  3. Floating Point Data Type

  4. Floating Point Data Type • Recall the bits in the fractional part are of the form 1.b-1b-2…b-j • The corresponding decimal number is 1x20 + b-1x2-1+b-2x2-2+… + b-j 2-j

  5. Floating Point Data Type • If the exponent=00000000, then we can represent tiny numbers. • In this case, we assume the leading digit is zero and not 1 and exp=-126. That is, it is of the form -1s 0.fraction x 2-126

  6. Floating Point Data Type • Consider the floating point value 0 00000000 0000100000000000000000 • This is + 2-5 x 2-126 = 2-131

  7. Floating Point Data Type • Interpret the floating point values • 0 11111110 1111111111111111111111 • 1 00001101 0111000000000000000000 • 1 00000000 0000000000001000000000

  8. ASCII Codes • Another standard of representation is one for transferring character codes • This is an eight bit code referred to ASCII • ASCII stands for American Standard Code for Information Exchange • It simplifies the interface between I/O devices among companies

  9. ASCII Codes • Each key on a keyboard is identified by a unique ASCII code • The digit 3 is (00110011)2 = (41)10, digit 3 is (00110010)2 = (40)10 • The letter ‘e’ is (01100101)2 and carriage return is (00001101)2

  10. ASCII Codes • The list of codes are at the back of the book for all 256 ASCII codes • Some codes are associate with multiple keys, such as ‘e’ and ‘E’

  11. Hexadecimal Notation • One form that is common for reading values on the computer is called hexadecimal notation • Hexadecimal notation is the base 16 representation of the number

  12. Hexadecimal Notation • We use 0-9 for the same numbers in hexadecimal • What about 10-15? • We use the letters A-F

  13. Hexadecimal Notation • A – 10 • B – 11 • C – 12 • D – 13 • E – 14 • F - 15

  14. Hexadecimal Notation • Consider the binary string 0011110101101110 • This can be broken into groups of 4 bits: 0011 1101 0110 1110 • Now, recall that the range of 4 bits is 0 -15, just like hexadecimal notation

  15. Hexadecimal Notation • Hence, the numbers represent • We typically prefix this by x or 0x to indicate hexadecimal form • So our binary number is 0x3D6E

  16. Hexadecimal Notation • What is the number 0x5A6C in binary form? • Thus, (5A6C)16 = (0101 1010 0110 1100)2

More Related