changeset 12611:708186085e0d

mat2str.m: Limit the number of digits to one less than available for double.
author Patrick Häcker <magicmuscleman>
date Sun, 17 Apr 2011 11:57:26 -0400
parents bdf694af4aa5
children 0e79664b969c 2fa14ae5b2c4
files scripts/ChangeLog scripts/strings/mat2str.m
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Sat Apr 16 10:39:54 2011 -0400
+++ b/scripts/ChangeLog	Sun Apr 17 11:57:26 2011 -0400
@@ -1,3 +1,8 @@
+2011-04-17  Patrick Häcker  <magicmuscleman>
+
+	* strings/mat2str.m: Limit the number of digits to one less than
+	available for double.
+
 2011-04-15  Kai Habel  <kai.habel@gmx.de>
 
 	* general/interp1.m, polynomial/mkpp.m, polynomial/pchip.m,
--- a/scripts/strings/mat2str.m	Sat Apr 16 10:39:54 2011 -0400
+++ b/scripts/strings/mat2str.m	Sun Apr 17 11:57:26 2011 -0400
@@ -28,7 +28,7 @@
 ## scalar then both real and imaginary parts of the matrix are printed
 ## to the same precision.  Otherwise @code{@var{n} (1)} defines the
 ## precision of the real part and @code{@var{n} (2)} defines the
-## precision of the imaginary part.  The default for @var{n} is 17.
+## precision of the imaginary part.  The default for @var{n} is 15.
 ##
 ## If the argument 'class' is given, then the class of @var{x} is
 ## included in the string in such a way that the eval will result in the
@@ -56,13 +56,13 @@
 
   if (nargin < 2 || isempty (n))
     ## Default precision
-    n = 17;
+    n = 15;
   endif
 
   if (nargin < 3)
     if (ischar (n))
       cls = n;
-      n = 17;
+      n = 15;
     else
       cls = "";
     endif
@@ -137,3 +137,4 @@
 %!assert (mat2str (true), "true");
 %!assert (mat2str (false), "false");
 %!assert (mat2str (logical (eye (2))), "[true,false;false,true]");
+%!assert (mat2str (0.7), "0.7")