lua-users home
lua-l archive

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

As i see it, Lua handles Numbers. In the scripts that's what they are.
Somewhere in the docs it is stated that they are actually represented as
C floats, but that only representation, not what they are in the logic
you write. 
As all representations (floats, fixed point, bignum, whatever) have
holes, if one of those holes affects your logic you have no choice but
to change representation. C floats are used in Lua because they are
portable, well defined, already implemented and widely useful. If c
floats do not represent what your understanding of what a Number is,
implement your own representation. It has been done before. 


On lun, 2011-06-06 at 11:00 +0100, Reuben Thomas wrote:
> On 6 June 2011 10:24, Dirk Laurie <> wrote:
> > Easy.  I don't even need the C standard.  The IEEE 754 standard is
> > enough.  The Wiki article I quoted is enough, if you trust a Wiki.
> And herein another general principle: Lua delegates arithmetic to C,
> which delegates to IEEE 754. From which we get two major benefits:
> consistency (Lua works the same as C, and as most other languages, for
> floating point) and quality (because the IEEE 754 standard is the
> outcome of a lot of expertise, practice and careful thought).