[Lada-commits] [PATCH] show trailing '0' in exponential notation

Wald Commits scm-commit at wald.intevation.org
Thu Mar 10 10:45:59 CET 2016


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1457603150 -3600
# Node ID 7fa853864d9b74ea056c18397dc4f985a23603ac
# Parent  cc17de34c6891d3e7cfc2e43b72074bd572c2941
show trailing '0' in exponential notation.

diff -r cc17de34c689 -r 7fa853864d9b app/model/Messwert.js
--- a/app/model/Messwert.js	Wed Mar 09 16:27:58 2016 +0100
+++ b/app/model/Messwert.js	Thu Mar 10 10:45:50 2016 +0100
@@ -59,7 +59,8 @@
             var parts = tmp.split('e');
             if (parts[0].indexOf('.') > 0) {
                 var floatPart = parseFloat(parts[0]);
-                parts[0] = floatPart.toLocaleString();
+                var separator = floatPart.toLocaleString().replace(/[-\d]/g, '');
+                parts[0] = floatPart.toFixed(3).replace('.', separator);
             }
             return parts[0] + 'e' + parts[1];
         }
diff -r cc17de34c689 -r 7fa853864d9b app/model/Zusatzwert.js
--- a/app/model/Zusatzwert.js	Wed Mar 09 16:27:58 2016 +0100
+++ b/app/model/Zusatzwert.js	Thu Mar 10 10:45:50 2016 +0100
@@ -56,7 +56,8 @@
             var parts = tmp.split('e');
             if (parts[0].indexOf('.') > 0) {
                 var floatPart = parseFloat(parts[0]);
-                parts[0] = floatPart.toLocaleString();
+                var separator = floatPart.toLocaleString().replace(/[-\d]/g, '');
+                parts[0] = floatPart.toFixed(3).replace('.', separator);
             }
             return parts[0] + 'e' + parts[1];
         }
@@ -91,7 +92,8 @@
             var parts = tmp.split('e');
             if (parts[0].indexOf('.') > 0) {
                 var floatPart = parseFloat(parts[0]);
-                parts[0] = floatPart.toLocaleString();
+                var separator = floatPart.toLocaleString().replace(/[-\d]/g, '');
+                parts[0] = floatPart.toFixed(3).replace('.', separator);
             }
             return parts[0] + 'e' + parts[1];
         }


More information about the Lada-commits mailing list