[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Serialization of math.huge
- From: Paul K <paulclinger@...>
- Date: Tue, 29 May 2012 11:24:42 -0700
> That is, if the value being serialized is equal to math.huge, instead
> write out the expression 1 / 0 and if the value being serialized is not
> equal to itself (the only way I found to identify the undefined value),
> serialize it as the expression 0 / 0 and otherwise use tostring.
I have similar logic, but use math.huge instead of 1/0:
type(s) == "number" and (s ~= s and '0/0'
or s == math.huge and 'math.huge' or s == -math.huge and '-math.huge') ...
[math.huge] = -math.huge
I'm indeed running on Windows and haven't had a chance to test on
other platforms, so I'm not sure if this is Windows-only effect or
not, but this code should work fine on other platforms too...