generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Rounding to one DP?

Previous Thread :: Next Thread 
3rdblox is not online. 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
Trapper4O77 is not online. Trapper4O77
Joined: 03 Aug 2011
Total Posts: 5648
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 is not online. 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
Trapper4O77 is not online. Trapper4O77
Joined: 03 Aug 2011
Total Posts: 5648
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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image