|
| 12 May 2013 10:34 AM |
How do you change a decimal number to a whole number? Rounded to the nearest whole number.
1.89978978 = 2 for example. |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
| |
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
|
| 12 May 2013 10:41 AM |
local num = 1.899789987
function giveWholeNumber(number) if math.modf(number)[2] <= .4 then return math.floor(number) else return math.ceil(number) end end
giveWholeNumber(num)
I guess. |
|
|
| Report Abuse |
|
|