At 7:40 AM -0400 6/23/02, David H. Bailey wrote: >127 is actually NOT one less than a power of two, since computers >use 0 as a real number, so 0-127 represent 128 values, which is a >common number to run into in programming,
127 is 2 to the 7th - 1, also known as 0111 1111 (in binary). For variables and constants defined as <signed char> (equivalent to <signed short> in most older, and many current, compilers) this is the largest positive number. The eighth bit is reserved for the sign. Thus 0000 0000 is zero and 1000 0000 (intuitively negative zero) is -128: the largest negative number. Confusion arises because most programming languages begin indexing arrays with the "zeroth" item. Thus the final item in an entirely filled array whose index is defined as <short> or <char> would be the 256th item, but its actual index value would be 255 (1111 1111 in binary). Similarly you find lists capable of storing 65536 items but integer ranges of +32767 to -32768. This can be a "gotcha" at the negative limit because some systems define -32768 (1000 0000 0000 0000) as minus zero. >0-127 can be represented by half a byte. The largest value that can be represented in a byte (unsigned) is 1111 1111 (binary) which translates to 255. The largest value that can be accommodated by half a bye (aka a nibble) is 1111 which translates to 15. Best wishes, -=-Dennis -- _______________________________________________ Finale mailing list [EMAIL PROTECTED] http://mail.shsu.edu/mailman/listinfo/finale