1 / 10

computer science

CSCI 1001. overview of. computer science. REPRESENTING DATA II. bit: a value that is either 0 or 1. string: a sequence of bits. byte: a string of 8 bits. Bi nary. A bit string can represent a number:. 10110 =. 1×2 4 +0×2 3 +1×2 2 +1×2 1 +0×2 0. A byte has the place values: .

metea
Télécharger la présentation

computer science

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. CSCI 1001 overview of computer science REPRESENTING DATA II

  2. bit: a value that is either 0 or 1 string: a sequence of bits byte: a string of 8 bits

  3. Binary A bit string can represent a number: 10110 = 1×24+0×23+1×22+1×21+0×20 A byte has the place values: What is the smallest possible byte? the largest?

  4. 1 1 1 1011 0111 + 1 0 0 1 0 Binary Adding Rules 1 0 1 0 1 1 0 0 1 1 1 + + + + + 0 1 1 1 0 1 1

  5. 1000 = 000 111 001 110 010 101 011 100 Modular Arithmetic

  6. 1000 = 000 -1 = 8-1 001 -2 = 8-2 010 -3 = 8-3 011 -4 = 8-4 Two’s Complement

  7. 8-bit two’s complement: -x = 28-x 100000000 256-x = (255 –x) + 1 01101001 - 11111111 To compute -x: “flip” the bits & add 1! 01101001 - 100101 1 0 + 1 10010111 x-y = x + (256-y) = x-y + 256

  8. What do the following mean? 3.142 mantissa exponent 6.022 × 1023 1.616 × 10-35 base Mantissa Exponent Largest # 2 1 9.9×109 4 2 9.999×1099

  9. in binary: 0.1101₂ = 1×2-1+1×2-2+0×2-3+1×2-4 0.1101×211₂ = 1×22+1×21+0×20+1×2-1 Mantissa Exponent Largest # 4 4 0.1111×215 9 5 0.111111111×231 52 10 ≈21023 ≈ 10307

  10. http://cs1001.us/ Please read this article for Friday’s lecture: http://en.wikipedia.org/w/index.php?title=Markup_language&oldid=406618521

More Related