I think you're looking for Math.round()

Math.floor() always rounds down
Math.ceil() always rounds up

regards,
Muzak

----- Original Message ----- 
From: "Martin Tremblay" <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Thursday, October 19, 2006 7:27 PM
Subject: [Flashcoders] using parseInt() and Math.floor() doesn't return thesame 
value



I'm wandering if we should continue to use Math.floor() and Math.ceil()
since they are unreliable.

Code:
var a = 2.999999999999999;

trace(parseInt(a.toString()));
trace(Math.floor(a));
trace(a);

output:
3
2
3


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to