CoderZone.org

Category: >> JavaScript >> Rounding numerical fields Bookmark and Share

<< lastnext >>

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;
}
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 1