lua-users home
lua-l archive

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


Lua and its API (lua_tostring() lua_tonumber()) does automatic
conversion between numbers and strings representing numbers.
This symmetry seems to be broken for special floating point
values representing +/- infinity or various "not a numbers".

E.g.
< infinity = 1/0
< print(infinity)
> 1.#INF
< print(math.sin(infinity))
> -1.#IND
< print(math.sin("1.#INF"))
> bad argument #1 to `sin' (number expected, got string)

Why?