diff --git a/lib/less/functions.js b/lib/less/functions.js index 8da556de..7e199938 100644 --- a/lib/less/functions.js +++ b/lib/less/functions.js @@ -179,8 +179,15 @@ tree.functions = { str = str.replace(/%%/g, '%'); return new(tree.Quoted)('"' + str + '"', str); }, - round: function (n) { - return this._math('round', n); + round: function (n, f) { + var fraction = typeof(f) === "undefined" ? 0 : f.value; + if (n instanceof tree.Dimension) { + return new(tree.Dimension)(number(n).toFixed(fraction), n.unit); + } else if (typeof(n) === 'number') { + return n.toFixed(fraction); + } else { + throw { type: "Argument", message: "argument must be a number" }; + } }, ceil: function (n) { return this._math('ceil', n);