Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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