Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicStuff/8974860 to your computer and use it in GitHub Desktop.
Save nicStuff/8974860 to your computer and use it in GitHub Desktop.
Math.mult = function(a, b) {
var aSplitted = a.toString().split('.');
var bSplitted = b.toString().split('.');
var aDelta = (aSplitted[1] ? aSplitted[1] : "").length;
var bDelta = (bSplitted[1] ? bSplitted[1] : "").length;
// a * b
return ((a * Math.pow(10, aDelta)) * (b * Math.pow(10, bDelta))) / (Math.pow(10, aDelta) * Math.pow(10, bDelta));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment