Re: Hexadecimal numbers in Eu
- Posted by D L <d1eu at yahoo.ca> Sep 18, 2004
- 405 views
It is just a matter of interpretation. Do you use 00000000-FFFFFFFF as an all positive range, or split it halfway to have positive and negative values?. The halfway is the tricky part, because it does not follow the "normal" decimal sequence, i.e. start at the most negative, thru zero and on to the most positive. You start at 0 dec/hex, go up to the largest positive (7F FF FF FF) and then continue counting from the most negative (80 00 00 00) up to -1 dec/FF FF FF FF hex. To get negative decimal values test hex, if it is #80 00 00 00 or larger then use formula: negative decimal=-(not_bits(hex)+1) All assuming hex is represented using 4 bytes (note: print %x seems to set the limit at 4 bytes). Denes L.