0

I am trying to understand

Blockquote

how to figure out the logical block number and offset.

 Offset from beginning of file: 2000 bytes.
 Block size = 512 bytes.
 2000 / 512 = 3 with a remainder of 464.
 Logical block number = 3.
 Oset within block = 464.

So it seems to find this you just divide the Offset from the Block size. But when I do this I get 3.90625.

Why is this different from the example? What am I doing wrong? Thanks.

Taifun
  • 6,165
  • 17
  • 60
  • 188
  • Can you explain? Still not sure how you get 3.464 when you divide 2000/512? Thanks. – Andrew Stockton Oct 25 '14 at 03:22
  • Ah, missed the point first. http://en.wikipedia.org/wiki/Remainder – user3159253 Oct 25 '14 at 05:56
  • It's hard to explain since we cannot see your sample code ("Blockquote" is displayed instead). But if you are using Python, there is a difference between Python 2 and Python 3 regarding division. With Python 2, `2000 / 512 == 3` whereas with Python 3, `2000 / 512 == 3.90625`. To perform an entire division with Python 3, the `//` operator should be used. – Christophe Vu-Brugier Oct 25 '14 at 08:38

1 Answers1

0

3 is the quotient, and 464 is the remainder. To find the remainder, use 2000 mod 512. Using 2000 / 512 is giving you the correct answer but in decimal format.

Tes
  • 1