Fixes round attempts on infinite numbers

This commit is contained in:
Simone Mainardi 2018-12-14 12:30:17 +01:00
parent af02c76c8b
commit 7f21b11dfb

View file

@ -12,7 +12,10 @@ function format_utils.round(num, idp)
return 0
end
if num == math.floor(num) then
if math.abs(num) == math.huge then
-- This is an infinite, e.g., 1/0 or -1/0
res = num
elseif num == math.floor(num) then
-- This is an integer, so represent it
-- without decimals
res = string.format("%d", math.floor(num))