better handling of infinity (fixes #7)

This is especially important with Lua 5.2.