Created
December 12, 2013 15:33
-
-
Save jonkemp/7929835 to your computer and use it in GitHub Desktop.
Format decimal numbers to prevent rounding errors. The first function limits decimal numbers to 2 places. The function always returns the number in number format even if you input the number as a string.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getDecimalLimit2(mnt) { | |
return (Math.round(mnt * 100)) / 100; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment