Re: More Lua number types

  • From: Dimiter 'malkia' Stanev <malkia@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 01 Aug 2012 00:09:40 -0700

On 8/1/2012 12:04 AM, Szabó Antal wrote:
Hi,

How hard would it be to add multiple number types (float, double,
(u)int(8|16|32|64)) to luajit as native lua types?
I tried using ffi integer types, but the generated code is much worse
than with the number type, I guess because of allocations the ffi
needs.


Antal Szabó

There is only one numeric type in the lua land - "number":
> print(type(1))
number
> print(type(1.3))
number

If you want a full numeric tower, then you have to deal with promotion rules,
underflow, overflow handling, etc.

It won't be anymore "lua" I guess...

Other related posts: