[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] file_slurp - read/write entire files from/to a string (module design discussion)
- From: David Manura <dm.lua@...>
- Date: Sat, 5 Nov 2011 18:28:22 -0400
On Thu, Nov 3, 2011 at 10:43 PM, HyperHacker <hyperhacker@gmail.com> wrote:
> On Thu, Nov 3, 2011 at 20:29, David Manura <dm.lua@math2.org> 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.
[1] http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
"Version numbers should be boring"