actionscript 3 - how to get numbers to have precision of .05? -


The following will ensure that a large number is only accurate for the hundredth place ():

  
Public Celebration Round (SC: Number): Number {sc = sc * 100; Sc = Math Floor (SC); Sc = sc / 100; Return SEC; }

What is the best way to score my numbers for accuracy of 0.05? Is there something clever with little change to get this result? For example, I would like to:

3.4566 = 3.45

3.04232 = 3.05

3.0 9 = 3.1

3.32 = 3.3

You can multiply by 20x, then divide by 20.

EDIT: You want to use Math.round () instead of Math.floor (), otherwise your trial case will change to 3.09 3.05.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -