[SPAM-Bayes] - Re: Converting IBM Floats..Help.. - BayesianFilter detected spam

Scott David Daniels Scott.Daniels at Acm.Org
Fri Mar 26 15:38:43 EST 2004


Jeff Epler wrote:
> Here's one page I found with an explanation of how more standard
> floating-point numbers are stored:
>     http://ccrma-www.stanford.edu/~jos/mdft/Floating_Point_Numbers.html
> The most important difference between the IEEE formats and the IBM
> format is that the radix is 16 instead of 2.  I think there's also a
> terminlogy error--the page says that the significand (mantissa) is
> stored in "two's compliment binary", but this isn't true.  It's
> unsigned.  The sign is stored separately.
Actually, a common trick is to use "two's complement binary" on the 
entire word, not simply the mantissa.  Then the same hardware can be
used to negate integer and floating values.  The way you take apart
negative numbers is (1) record the sign, and (2) take the absolute value 
of the whole thing (3) breaking exponent and mantissa out.

You might find my weird little bits module helpful to take your floating
point values in python apart in order to send them around.

     http://members.dsl-only.net/~daniels/bits.html

-- 
-Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list