Re: 64 bit integers (unsigned and not) for math functions

  • From: Юрий Соколов <funny.falcon@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 9 Mar 2015 10:05:41 +0300

Is it possible to add into 'bit' package arithmetic operations for int32
and int64? With signed/unsigned division variants.
08.03.2015 23:50 пользователь "Mike Pall" <mike-1503@xxxxxxxxxx> написал:

> Some Guy wrote:
> > Are there any plans to support 64 bit integers with the math/bitwise
> > functions? I use these rather extensively and it would be nice to be able
> > to use them without some trickery.
>
> The v2.1 branch supports bitwise operations on 64 bit integers.
>
> But most math functions operate on floating-point numbers. Even if
> these would accept any type of integer number as an input, they
> have to produce a floating-point number of some type as output.
> Since there's no universally supported standard floating-point
> type that's able to hold 64 bits of mantissa, there are no
> universally available math library functions that support this
> (and most arbitrary-precision math libraries are bigger than
> LuaJIT itself).
>
> Of course you can always explicitly convert a 64 bit integer to a
> Lua number (a double) with tonumber(). But then you have to accept
> the precision loss. IMHO a tonumber() in the code serves as a
> useful warning this might incur a lossy conversion.
>
> --Mike
>
>

Other related posts: