[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua with ints and floats
- From: Adolf Mathias <dolfi@...>
- Date: Tue, 11 Jul 2000 18:37:09 +0200
My two cents to the bitshift issue:
If you have access to a reasonably complete math lib (exists even for
Vicious C++ 6.0), 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)
{
lua_pushnumber((lua_Number)
(ldexp(luaL_check_number(1),(int)luaL_check_number(2))));
}
or, what probably makes more sense, make ldexp accessible.
Ciao, Dolfi
--
Adolf Mathias EMail: dolfi at zkm dot de Web: www.zkm.de
|||| / |< ||| ZKM Institute for Visual Media - Institut für Bildmedien
P.B. 6919 D-76049 Karlsruhe, Germany; fon +49 721-8100-1544, fax -1509