PDA

View Full Version : Rounding of Values



trembot_89
May 20th, 2018, 19:39
Hello all,

I'm interested in the function to round calculated fractions into whole numbers, specifically when the numbers get rounded and in which direction? The project I'm working needs numbers rounding up instead of down. If FG works by rounding to the nearest whole I could probably get away with adding .5 to the end result, or if it consistently rounds down then I will add .9 (both assuming only 1 number exists after the decimal point). It would be nice to know what is the default so I know which edit will work best. Thanks.

-Kevin

Andraax
May 20th, 2018, 20:41
There is both a ceil (round up) and floor (round down) function.

https://www.lua.org/manual/5.1/manual.html#5.6

trembot_89
May 20th, 2018, 20:43
Thank you Andraax