lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sep 10, 2002 at 03:51 +0100, Reuben Thomas wrote:
> > One problem though:  -A := not(A)+1  is for 2-complement.
> > Floating point numbers (normally) do not use 2-complement
> > arithmetic.
> 
> ? It works for integers, and normally you just want to use the mantissa to 
> store the bit-string, i.e. you're treating floats as ints.

Well, the actual raw bits in the mantissa aren't "correct", because
there's a separate sign bit while the mantissa is just magnitude.  But
when you convert the double to an integer (i.e. in a wrapped C
function), it should come out right.

-- 
Thatcher Ulrich
http://tulrich.com