@YuHao has already indicated what it means +/- 1. # INF (+ -inf) and -1. # IND (nan), so Iβll just add how to deal with this (which I just needed) in Lua:
- "inf" (+/- 1. # INF) are the higher values ββthat can be represented (Lua / C), and the language provides this constant for you: "math.huge". That way you can test the number inside Lua for + -INF; the "isINF ()" function below shows how to use it.
- "nan" (- 1. # IND) is something that cannot be processed numerically: it must be a number, it does not exist, and all you do with it is something like a number. Bearing in mind that no NaN is equal to other NaN; check for NaN as the function "isNAN ()" below.
local function isINF(value) return value == math.huge or value == -math.huge end local function isNAN(value) return value ~= value end
source share