Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript two decimal places after division

Math.round(num * 100) / 100
//OR to be more specific and to ensure things like 1.005 round correctly, use Number.EPSILON :
Math.round((num + Number.EPSILON) * 100) / 100
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #decimal #places #division
ADD COMMENT
Topic
Name
5+2 =