Last active
August 29, 2015 14:05
-
-
Save wjmazza/aeec68c1c48e45033d69 to your computer and use it in GitHub Desktop.
Revisions
-
Walter Mazza revised this gist
Sep 2, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ function parseDecimal(numberVal) { wholeNumber = numberVal - modValue, // returns the whole number wholeNumberLength = wholeNumber.toString().length, // amount of digits in number decimalLength = numberVal.toString().length - wholeNumberLength - 1, // amount of digits after decimal (-1 for decimal itself) decimalNumber = Math.round(modValue * Math.pow(10,decimalLength)); // fix decimal places to original length and remove decimal point return decimalNumber; } -
Walter Mazza revised this gist
Sep 2, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ function parseDecimal(numberVal) { wholeNumber = numberVal - modValue, // returns the whole number wholeNumberLength = wholeNumber.toString().length, // amount of digits in number decimalLength = numberVal.toString().length - wholeNumberLength - 1, // amount of digits after decimal (-1 for decimal itself) decimalNumber = Math.ceil(modValue * Math.pow(10,decimalLength)); // fix decimal places to original length and remove decimal point return decimalNumber; } -
Walter Mazza revised this gist
Sep 2, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ function parseDecimal(numberVal) { wholeNumber = numberVal - modValue, // returns the whole number wholeNumberLength = wholeNumber.toString().length, // amount of digits in number decimalLength = numberVal.toString().length - wholeNumberLength - 1, // amount of digits after decimal (-1 for decimal itself) decimalNumber = Math.ceil(modValue,Math.pow(10,decimalLength)); // fix decimal places to original length and remove decimal point return decimalNumber; } -
Walter Mazza revised this gist
Sep 2, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ function parseDecimal(numberVal) { var modValue = numberVal % 1, // returns modulous of number wholeNumber = numberVal - modValue, // returns the whole number wholeNumberLength = wholeNumber.toString().length, // amount of digits in number decimalLength = numberVal.toString().length - wholeNumberLength - 1, // amount of digits after decimal (-1 for decimal itself) decimalNumber = parseFloat(modValue.toFixed(decimalLength)) * Math.pow(10,decimalLength); // fix decimal places to original length and remove decimal point return decimalNumber; -
Walter Mazza revised this gist
Sep 2, 2014 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ // not tested for localized usage, developed for en-US function parseDecimal(numberVal) { var modValue = numberVal % 1, // returns modulous of number wholeNumber = numberVal - modValue, // returns the whole number wholeNumberLength = wholeNumber.toString().length, // amount of digits in number decimalLength = numberVal.length - wholeNumberLength - 1, // amount of digits after decimal (-1 for decimal itself) decimalNumber = parseFloat(modValue.toFixed(decimalLength)) * Math.pow(10,decimalLength); // fix decimal places to original length and remove decimal point return decimalNumber; } -
Walter Mazza created this gist
Sep 2, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ // not tested for localized usage, developed for en-US function parseDecimal(numberVal) { var modValue = numberVal % 1, wholeNumber = numberVal - modValue, wholeNumberLength = wholeNumber.toString().length, decimalLength = wholeNumberLength - modValue - 1, decimalNumber = parseFloat(modValue.toFixed(decimalLength)) * Math.pow(10,decimalLength); return decimalNumber; }