Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-28-2003, 11:06 AM   #1
mrand01
Senior Member
 
Join Date: Jun 2003
Location: Morris Plains, NJ
Posts: 621
Send a message via AIM to mrand01
Default Rounding numbers with decimals

how would I go about rounding a number with 3 decimals to just 1 decimal.

ex: 1.169 = 1.2

I know they have Math.Ceil, etc., but thats for integers, not floating point numbers...
mrand01 is offline   Reply With Quote
Old 10-28-2003, 11:11 AM   #2
annexion
I make out with chicks
 
Join Date: Oct 2002
Location: NYC
Posts: 1,586
Default

ActionScript Code:
numVar=3.141592654; rounded=Math.round(numvar*10)/10;
Essentially you're multiplying it by ten so you get the one decimal place over to be able to round it, then you're dividing by ten to get the decimal place back.

Hope that helps, good luck.
__________________
www.perpetuated.com
annexion is offline   Reply With Quote
Old 10-28-2003, 11:15 AM   #3
mrand01
Senior Member
 
Join Date: Jun 2003
Location: Morris Plains, NJ
Posts: 621
Send a message via AIM to mrand01
Default

hmm, i thought of that, just kinda figured there would be a built in function, guess not...thanks
mrand01 is offline   Reply With Quote
Old 10-28-2003, 11:33 AM   #4
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

you can make it one.

http://proto.layer51.com/d.aspx?f=65
__________________
(6)
senocular is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:57 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.