[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua with ints and floats
- From: "Mauro Vezzosi"<mvezzosi@...>
- Date: Wed, 12 Jul 2000 08:57:50 +0200
> ... you may use ldexp, which directly adds its second integer
> argument to the IEEE FP exponent of the first double argument
> and returns the result.
> static void bitshiftleft(lua_State *L)
ldexp() don't adds its second argument but sets it as the exponent, so
you must add it manually to the exponent of the first argument.
And ldexp() doesn't resolve the problem of the fractional part and the
overflow of a real integer type (I mean that you should check if the
result is bigger than 2^16 or 2^32).
Just a curiosity: why ldexp() and frexp() are in the Lua math library ?
Are they so much used ? Isn't it more useful modf() which breaks down a
double value into fractional and integer parts ?