PDA

View Full Version : visible decimal places..


nFNTy
01-09-2003, 03:23 PM
i just made a quick count down thingy, it starts at 3.00 and continually decreases by 0.01.. but.. when it gets to about 2.75, it adds a load of 0s at the end (2.74000000 etc..) how do i get rid of this?

tg
01-09-2003, 03:32 PM
use this (http://www.actionscripts.org/forums/showthread.php3?s=&threadid=2652) code by robert penner to force it to 2 decimal places.

nFNTy
01-09-2003, 03:43 PM
wow.. thanks man.

annexion
01-09-2003, 06:52 PM
output=(100*Math.round(input))/100;

There's a quick way to round to two places.Change 100 to 1000 to round to three places and to 10 for one place. Just my .02¢

Good luck.