[Pkg-javascript-commits] [less.js] 13/50: reworked internal decimal rounding function.

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:22:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v1.7.1
in repository less.js.

commit 46c12ef664aabc2bd08524c6128a47b6cf1a817e
Author: seven-phases-max <seven.phases.max at gmail.com>
Date:   Fri Apr 4 07:38:03 2014 +0400

    reworked internal decimal rounding function.
---
 lib/less/functions.js | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/lib/less/functions.js b/lib/less/functions.js
index 7f048a4..f44e295 100644
--- a/lib/less/functions.js
+++ b/lib/less/functions.js
@@ -749,13 +749,8 @@ function clamp(val) {
 }
 
 tree.fround = function(env, value) {
-    var p;
-    if (env && (env.numPrecision != null)) {
-        p = Math.pow(10, env.numPrecision);
-        return Math.round(value * p) / p;
-    } else {
-        return value;
-    }
+    var p = env && env.numPrecision;
+    return (p == null) ? value : +(value + 2e-16).toFixed(p);
 };
 
 tree.functionCall = function(env, currentFileInfo) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list