[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: stackoverflow with LuaJIT 2.0.0-beta6 (but not with lua 5.1.4)
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 20 Apr 2011 11:16:01 -0300
> -- convert big or small number in scientific notation into a decimal string
Why not something like this?
function xtostring(x)
local f=string.format
for k=0,99 do
local s=f("%."..k.."f",x)
local y=tonumber(s)
if y==x then return s,k end
end
end
The main limitation is that string.format does not allow more than %.99f.