lua-users home
lua-l archive

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


On 6 June 2011 10:24, Dirk Laurie <dpl@sun.ac.za> 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).

This practice is much the same sort of reuse we employ when
programming, so I can't understand why any programmer would think it a
bad thing. Lua happens to be particularly good at it, as it delegates
pretty much everything that it can to standards. (There are some
interesting questions about why so much remains to be reinvented
afresh in each language, but that's for another thread.)

And I would argue that it's not detrimental to one's understanding of
Lua, but beneficial: neophytes already know what arithmetic is, and
aren't bamboozled by a long section in the manual on how arithmetic is
done in Lua; those who need to know more details can go to the C
standard which will (in the case of arithmetic) direct them onwards to
IEEE 754. The biggest problem here is that, unlike the manual, not all
of these standards are freely available in their approved form. I
don't know about IEEE standards, but all you can find of ISO C is
various drafts. Deeply depressing that after decades of free software
ISO X.3 (computing committee) stiill hasn't worked out a relevant
business model, but there you go.

-- 
http://rrt.sc3d.org