3rdblox
|
  |
| Joined: 09 Dec 2012 |
| Total Posts: 4741 |
|
|
| 15 Oct 2013 09:40 AM |
| I need to round numbers to one decimal point. Is there a way to do this? |
|
|
| Report Abuse |
|
|
|
| 15 Oct 2013 09:42 AM |
math.ceil()
math.floor()
then divide by 10/100 (Or another power of ten) to get the decimal you want. |
|
|
| Report Abuse |
|
|
3rdblox
|
  |
| Joined: 09 Dec 2012 |
| Total Posts: 4741 |
|
|
| 15 Oct 2013 09:51 AM |
How do I apply math.ciel? tim.Value = tim.Value - 0.1 tim.Value = tim.Value*10 tim.Value = tim.Value --Apply math.ciel? tim.Value = tim.Value/10 |
|
|
| Report Abuse |
|
|
|
| 15 Oct 2013 09:54 AM |
math.ceil rounds up math.floor rounds down
num=PUT NUMBER YOU WANT TO DECREASE BY HERE power=PUT THE POWER OF THE DECIMAL HERE (10,100, etc.)
tim.Value=tim.Value-(math.ceil(num)/power) |
|
|
| Report Abuse |
|
|
HaxHelper
|
  |
| Joined: 19 Dec 2009 |
| Total Posts: 1208 |
|
|
| 15 Oct 2013 10:26 AM |
| if you want to be more precise you could also implement rounding rules |
|
|
| Report Abuse |
|
|
getkoed
|
  |
| Joined: 18 Feb 2010 |
| Total Posts: 2298 |
|
|
| 15 Oct 2013 10:41 AM |
I'd say
local numtoberounded = 3.141592653589793 numtoberounded = math.floor(numtoberounded * 10) / 10 |
|
|
| Report Abuse |
|
|