..:D&G:.. Posted April 6, 2015 Posted April 6, 2015 Hello guys, from the maths (distance*0.6) I get a decimal number with 1 decimal place, is there anyway of rounding that up? Thanks. MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
Banex Posted April 6, 2015 Posted April 6, 2015 math.floor Not worry about the future. Very soon it will come.
xXMADEXx Posted April 7, 2015 Posted April 7, 2015 math.floor Actually, to round up it's math.ceil or you could use Math.round. The Ultimate Lua Tutorial! | MTA PHP SDK
WhoAmI Posted April 7, 2015 Posted April 7, 2015 Actually correct one is math.floor ( number + 0.5 ) or math.ceil ( number - 0.5 )
Et-win Posted April 7, 2015 Posted April 7, 2015 Actually correct one is math.floor ( number + 0.5 ) or math.ceil ( number - 0.5 ) He wants always its rounding up ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
WhoAmI Posted April 7, 2015 Posted April 7, 2015 Actually correct one is math.floor ( number + 0.5 ) or math.ceil ( number - 0.5 ) He wants always its rounding up I'll show you something. local n = 5.9; print ( math.floor ( n ) ); Output: 5 local n = 5.9; print ( math.floor ( n + 0.5 ) ); Output: 6 For correct rounding number you have to add this 0.5.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now