[Proposal] Support "inf", "-inf" and "-nan" in tonumber()
"'Martin Eden' via lua-l" <[email protected]> Thu, 18 Jun 2026 10:37:46 +0200
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
Current Lua implementation of tonumber() does not handle values "inf", "-inf" and "-nan" for string that supposed to be number value. But tostring() function produces them: Lua 5.5.0 Copyright (C) 1994-2025 Lua.org, PUC-Rio > tostring(1/0) inf > tostring(-1/0) -inf > tostring(0/0) -nan So tostring() value is useless for decoding number using tonumber(): > tonumber(tostring(1/0)) nil -- Martin -- You received this message because you are subscribed to the Google Groups "lua-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/531f02af-895a-46af-8eb9-1619cfdee53d%40disroot.org.