Created
March 2, 2017 12:32
-
-
Save tk120404/550fcb971ae11b8b4b2835829eab4878 to your computer and use it in GitHub Desktop.
decimal Adjustment in javascript
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 decimalAdjust(value) | |
{ | |
value = value.toString().split('e'); | |
value = Math.round(+(value[0] + 'e' + (value[1] ? (+value[1] + 2) : 2))); | |
value = value.toString().split('e'); | |
return +(value[0] + 'e' + (value[1] ? (+value[1] - 2) : -2)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment