lua-users home
lua-l archive

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


> float x = 5.f;
> x *= 2.f; // <<1
> x /= 2.f; // >>1
> Would be quickest!
But you must add floor() to cut off the decimal part:
x = floor(x * 2.f);
x = floor(x / 2.f);
And you should check if the new x is > 2^16 or 2^32.

I convert doubles to ulong, shift, and then convert them back to 
doubles.

Bye
Mauro