lua-users home
lua-l archive

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


> On Thursday, February 28, 2013 05:40:15 PM Christopher Berardi wrote:
>> I would welcome distinct number types (e.g., real, integer).

There is some reason to think that the team is planning subtypes,
specifically in order to allow efficient exploitation of
64-bit integers.

> > But, if we must use a single number type I would like it to work in
> > the following manner. A single number type would be comprised of 3
> > different types (C union?). If the number can be represented as an
> > integer, then it is an integer type. If the number cannot be
> > represented as an integer, then it is a real/double type. If the
> > number is too big for either an integer or a double, then it it a
> > bignum (i.e., arbitrary precision) type.

Arbitrary precision involves a large library like GMP, and does not
stop at integers. There exist a very convenient Lua binding `lgmp`
for GMP by Wim Couwenberg that will give you the required look-and-feel.

    http://members.chello.nl/~w.couwenberg/lgmp.htm

2013/3/1 TNHarris <telliamed@whoopdedo.org>:
> What about complex numbers?

And this has been done for us by Luiz: click `lcomplex` from

    http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/

I keep reminding myself, sadly not often enough, to look on that page
for something before rolling my own.

Dirk