In a recent note, Charles Mills said: > Date: Wed, 21 Feb 2007 15:52:53 -0800 > > Good thought. Let's see > > FFFFFFFF (-1) anded becomes > 7FFFFFFF (2147483647) divided by 256 becomes > 007FFFFF (8388607) and oring the bit back gives > 00FFFFFF QED > > FFFFFE00 (-512) anded becomes > 7FFFFE00 (2147483136) divided by 256 becomes > 007FFFFE (8388606) and oring the bit back gives > 00FFFFFE QED > > Maybe that will work. Thanks! Comments anyone? > I think we can be more formal than empirical here. Clearing the sign bit of a negative number is equivalent to subtracting 2^31. Then dividing by 2^8 yields a result biased by negative 2^23 (0x800000), which is set right by adding the bias back in.
But that algorithm will break when 64-bit Visual Basic arrives. Perhaps similar compatibility issues are delaying the advent of 64-bit COBOL. -- gil -- StorageTek INFORMATION made POWERFUL ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html