lua-users home
lua-l archive

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


On 10 April 2012 13:38, Alexander Gladysh <agladysh@gmail.com> wrote:
> On Tue, Apr 10, 2012 at 14:58, Luiz Henrique de Figueiredo
> <lhf@tecgraf.puc-rio.br> wrote:
>>> one can simply define them as global variables
>>
>> This seems to me to be a good compromise if you want to convert those
>> values frequently.
>
> Wouldn't work for Windows ( 1.#INF) with stock Lua.

So your local solution seems to be to redefine tostring() to trap
these three values and print something that will regenerate them.  On
this implementation (Linux/x86) that seems to be possible with inf and
-inf but I don't see how to detect nan portably.

inf = 1/0
nan = 0/0
print( inf == inf)
true
print( nan == nan )
false