1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
Description: reworked internal decimal rounding function
Origin: upstream, https://github.com/less/less.js/commit/46c12ef
Author: seven-phases-max <seven.phases.max@gmail.com>
Forwarded: yes
Last-Update: 2015-10-09
--- a/lib/less/functions.js
+++ b/lib/less/functions.js
@@ -718,13 +718,8 @@
}
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) {
|