lua-users home
lua-l archive

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


On ubuntu, tostring(1/0) gives "inf", and tonumber("inf") gives a number that's indeed the representation for infinite.
So for some systems, you can in fact put back into Lua what you get out (by going through tonumber)


On Thu, Jan 22, 2009 at 5:35 PM, Evan DeMond <evan.demond@gmail.com> wrote:
On Thu, Jan 22, 2009 at 11:28 AM, Linker <linker.m.lin@gmail.com> wrote:
Sorry for my mistake.
But I found that I cannot assign 1.#INF to a variable.
eg.


> i=1/0
> =i
1.#INF
> j=1.#INF
stdin:1: unexpected symbol near '#'
>


Correct me if I'm wrong on some point here - but 1.#INF isn't Lua syntax. It's just a way of printing the value you get from 1/0. So it only works one way; you can't put it back into Lua because it's not a valid Lua _expression_.

Evan