lua-users home
lua-l archive

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


Hi!
 
It seems that the same floating point hexadecimal number literal may be converted to different values depending on OS/library:
 
 
On Windows (Lua was built with MinGW64):
 
C:\>lua
Lua 5.4.2  Copyright (C) 1994-2020 Lua.org, PUC-Rio
> string.format("%a", 0x3.0000000000001f)
0x1.8p+1
 
 
On Linux
 
$ lua
Lua 5.4.2  Copyright (C) 1994-2020 Lua.org, PUC-Rio
> string.format("%a", 0x3.0000000000001f)
0x1.8000000000001p+1
 
 
Does this mean that specifying redundant digits in floating point literals (including hexadecimal literals) is discouraged because rounding in Lua is inconsistent?