I developed the below code to convert a number into an 8-digit
string such as would be found in a FAT. All is well until it
reaches some point. I haven't been able to find the exact point,
but when it reaches this point, it gives erronious results. For
example, 61,555,599 and 61,555,600 will return the same string,
i.e. 144 67 171 3.
According to the book, PB3.5 can digest numbers with 18-digits
of accuracy and 256 ^ 7 (the biggest I want it to hande here)
produces a 17-digit (BIG) number.
Any idea as to what's happening or what I am mis-reading?
------------------
[This message has been edited by Mel Bishop (edited January 14, 2003).]
string such as would be found in a FAT. All is well until it
reaches some point. I haven't been able to find the exact point,
but when it reaches this point, it gives erronious results. For
example, 61,555,599 and 61,555,600 will return the same string,
i.e. 144 67 171 3.
According to the book, PB3.5 can digest numbers with 18-digits
of accuracy and 256 ^ 7 (the biggest I want it to hande here)
produces a 17-digit (BIG) number.
Any idea as to what's happening or what I am mis-reading?
Code:
$lib all off $error all on color 14,1 cls dim sector as shared quad f$ = "###,###,###,###,###,###" for sector = 0 to 256 ^ 4 - 1 locate 3,10 print;using$(f$,sector); y$ = quadword8$(bycopy sector) locate 5,10 : print;"Quad Word: ";y$ locate 7,10 for x = 1 to len(y$) print;using$("### ",asc(mid$(y$,x,1))); next x if inkey$ = chr$(27) then exit for next sector end function quadword8$(temp) tt = 256 c8 = int(temp / (tt ^ 7)) : temp = temp - c8 * tt ^ 7 c7 = int(temp / (tt ^ 6)) : temp = temp - c7 * tt ^ 6 c6 = int(temp / (tt ^ 5)) : temp = temp - c6 * tt ^ 5 c5 = int(temp / (tt ^ 4)) : temp = temp - c5 * tt ^ 4 c4 = int(temp / (tt ^ 3)) : temp = temp - c4 * tt ^ 3 c3 = int(temp / (tt ^ 2)) : temp = temp - c3 * tt ^ 2 c2 = int(temp / tt) c1 = temp - c2 * tt function = chr$(c1) + chr$(c2) + chr$(c3) + chr$(c4) + _ chr$(c5) + chr$(c6) + chr$(c7) + chr$(c8) end function
------------------
[This message has been edited by Mel Bishop (edited January 14, 2003).]
Comment