lua-users home
lua-l archive

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


Hi!

Coda Highland <chighland <at> gmail.com> writes:

> On Tue, Mar 31, 2015 at 12:59 PM, Nagaev Boris <bnagaev <at> gmail.com> wrote:
> > On Tue, Mar 31, 2015 at 6:34 PM, Matthias Kluwe <mkluwe <at> gmail.com>
wrote:
> >>
> >> When converting a number object to a string, luaO_tostring gets called,
> >> which adds a "float mark" to floating point numbers that come out of
> >> sprint looking like an int, to the effect that "0" becomes "0.0".
> 
> It could be considered an error if this code asserts under any circumstances:
> 
> local x = 1.0
> local y = tonumber(tostring(x))
> assert(x == y, "roundtrip failed for forced suffix")

Yes, that's the problem put in a nutshell. Thank you for that, it will go
right into my set of local test cases.

Regards,
Matthias