Snippet Name: Rounding numerical fields
Description: This function rounds a float value using a precision of two decimal places.
Also see: » TO_BINARY_FLOAT
Comment: (none)
Author: CoderZone
Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: December 01st, 2010
|
// The following method rounds a float value
// using a precision of two decimal places:
function round(value) {
return Math.round(value * 100) / 100;
} |