[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: serialization of lua numbers
- From: Coda Highland <chighland@...>
- Date: Sun, 25 Mar 2012 10:53:16 -0500
5/6 can't be expressed as a floating-point number without a loss of
precision. You wouldn't even be able to do it with a C module. If it's
really important to you to get EXACTLY 5/6, you might consider using
some sort of rational number class.
/s/ Adam
On Sun, Mar 25, 2012 at 10:50 AM, Cosmin Apreutesei
<cosmin.apreutesei@gmail.com> wrote:
> Hi list,
> Stupid question maybe, but is there a way (without having to write a C
> module) to serialize Lua numbers without loss of precision? Eg. I
> tried printing a 5/6 with tostring, string.format with all formats
> immaginable etc. but couldn't get back a clean 5/6.
> Thanks,
> Cosmin.
>