lua-users home
lua-l archive

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

On Thu, Nov 3, 2011 at 10:43 PM, HyperHacker <> wrote:
> On Thu, Nov 3, 2011 at 20:29, David Manura <> wrote:
>> For example, _VERSION = 0.001001 is a
>> number (not string) of the form x.yyyzzz, which is a style that may be
>> debatable but allows trivial numeric comparison [2].
> Getting into 6 decimal places, I start to get nervous about loss of precision...

It works even when Lua is compiled with IEEE floats:

  for i=1000,10000000 do
    local version = i / 1E6
    assert(string.format("%1.6f", version) == string.format("%d.%06d",
(i-(i%1E6))/1E6, i % 1E6))
  end; print 'OK'

but not if Lua is compiled with integers, so maybe floats are bad here.

     "Version numbers should be boring"