Rounding
Question: How do I round a number to n decimal places?
Answer: You can use the following code to round a number:
Math.round(10*X)/10; // round to tenths
Math.round(100*X)/100; // round to hundredths
Math.round(1000*X)/1000; // round to thousandths
...
JavaScripter.net.
Copyright
© 1999-2006, Alexei Kourbatov