Wrong Developer Hub tonumber function description

Issue Description
Expected Behavior
It should say that tonumber() does not guarantee a valid number as the outcome (since NaN is simply not a number).

Actual Behavior
tonumber(“nan”) produces nan value, which causes a lot of issues if someone relies on that behavior and does not implement appropriate checks (as very comparison with NaN produces false).

tonumber(“nan(snan)”) → nan(snan)
tonumber(“nan(ind)”) → -nan(ind)

Workaround
Double-check the statements with tonumber in your games and make sure they’re not subject to this issue.
image

Issue Area: DevHub Content
Page URL: Strings & Lua Globals

1 Like

Thanks for the report. We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

1 Like

Follow up on this thread!

The function is behaving as intended now, tonumber(nan) does return nan, the documentation is correct!

Closing this thread based on the above!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.