changeset 531:77ada441f95a

Formatting
author Chris Cannam
date Tue, 04 Mar 2014 16:46:56 +0000
parents 0ebf2a6a83ee
children 326a52ed74a4
files src/may/matrix.yeti
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/may/matrix.yeti	Mon Mar 03 09:20:18 2014 +0000
+++ b/src/may/matrix.yeti	Tue Mar 04 16:46:56 2014 +0000
@@ -880,9 +880,12 @@
             [ "\nColumns \(c0) to \(c1)\n",
               (map do row:
                    map do v:
-                   //!!! not right -- want to round to 1dp of exp notation if less than 1e-4
-                       n = mm.round (v * 100000);
-                       strPad ' ' 10 "\(n / 100000)";
+                       strPad ' ' 10
+                          (if abs v >= 1000.0 or abs v < 0.01 then
+                               String#format("%.2E", [v as ~Double])
+                           else
+                               String#format("%5f", [v as ~Double])
+                           fi);
                    done (vec.list row) |> strJoin "";
                done (asRows (columnSlice m c0 (c1 + 1))) |> strJoin "\n")
             ];