[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Serialization of math.huge
- From: Rob Kendrick <rjek@...>
- Date: Tue, 29 May 2012 19:19:22 +0100
On Wed, May 30, 2012 at 01:07:00AM +0700, GrayFace wrote:
> Another aspect of numbers serialization is that after using
> tostring() you lose some precision of the number. It is possible to
> serialize numbers precisely using frexp and ldexp functions. I do it
> in my "pluto killer" serialization library which I haven't released
> yet.
On C99 systems, we used to be able to use string.format("%a", foo) for
this, to get a hex float. Unfortunately, some poor-quality (but
standards-compliant) C library implementations (ie, Micorosoft's)
explode in a sticky pile if you pass format modes they don't support,
rather than just ignoring them. So modern Luas check what format
strings are used and avoiding anything that isn't in C89.
B.