Return to Snippet

Revision: 13970
at May 14, 2009 10:08 by sidneydekoning


Initial Code
/* Returns a string representation of the number in fixed-point notation. 
Fixed-point notation means that the string will contain a specific number of digits after the decimal point, as specified in the fractionDigits parameter. 
The valid range for the fractionDigits parameter is from 0 to 20. 
Specifying a value outside this range throws an exception. 

*/

var num:Number = 4;
trace(num.toFixed(2)); // 4.00

var num:Number = 7.31343;
trace(num.toFixed(3)); // 7.313

Initial URL


Initial Description


Initial Title
Rounding of a Number to X decimals

Initial Tags


Initial Language
ActionScript 3