mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Fix for float to integer conversion
This commit is contained in:
parent
2f47b4a87e
commit
0921f88ce6
1 changed files with 5 additions and 1 deletions
|
|
@ -683,10 +683,14 @@ function round(num, idp)
|
|||
end
|
||||
--function round(num) return math.floor(num+.5) end
|
||||
|
||||
function truncate(x)
|
||||
return x<0 and math.ceil(x) or math.floor(x)
|
||||
end
|
||||
|
||||
-- Note that the function below returns a string as returning a number
|
||||
-- would not help as a new float would be returned
|
||||
function toint(num)
|
||||
return string.format("%u", num)
|
||||
return string.format("%u", truncate(num))
|
||||
end
|
||||
|
||||
function capitalize(str)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue