changeset 3674:ef883684e58e

[project @ 2000-06-07 17:11:33 by jwe]
author jwe
date Wed, 07 Jun 2000 17:11:34 +0000
parents e0b46234555e
children 59123cd0be83
files scripts/ChangeLog scripts/general/logical.m scripts/strings/strrep.m test/ChangeLog test/octave.test/quad/quad-1.m test/octave.test/quad/quad-2.m
diffstat 6 files changed, 25 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Mon Jun 05 18:28:54 2000 +0000
+++ b/scripts/ChangeLog	Wed Jun 07 17:11:34 2000 +0000
@@ -1,3 +1,8 @@
+2000-06-06  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* general/logical.m: Return arg if it is empty.  Better error
+	message for non-numeric types.	
+
 2000-05-31  A. Scottedward Hodel <a.s.hodel@eng.auburn.edu>
 
 	* control/base/dlqe.m: Update documentation.  Fix typo.  Warn
--- a/scripts/general/logical.m	Mon Jun 05 18:28:54 2000 +0000
+++ b/scripts/general/logical.m	Wed Jun 07 17:11:34 2000 +0000
@@ -38,10 +38,12 @@
 function y = logical (x)
 
   if (nargin == 1)
-    if (! islogical (x))
+    if (islogical (x) || isempty (x))
+      y = x;
+    elseif (isnumeric (x))
       y = x != 0;
     else
-      y = x;
+      error ("logical not defined for type `%s'", typeinfo (x));
     endif
   else
     usage ("logical (x)");
--- a/scripts/strings/strrep.m	Mon Jun 05 18:28:54 2000 +0000
+++ b/scripts/strings/strrep.m	Wed Jun 07 17:11:34 2000 +0000
@@ -60,8 +60,8 @@
     jump = length(y) - length(x);
     if (jump > 0)     # s expands
       di = ones(size(s));
-      di (ind) = 1 + jump * ones (length (ind), 1);
-      t (cumsum (di)) = s
+      di(ind) = 1 + jump * ones (length (ind), 1);
+      t(cumsum (di)) = s;
     elseif (jump < 0) # s contracts
       di = ones (jump * length (ind) + length (s), 1);
       di (ind + jump * [0:length(ind)-1]) = 1 - jump * ones(length(ind), 1);
@@ -76,15 +76,15 @@
     ind = ind + jump * [0:length(ind)-1];
     repeat = [1:length(y)]' * ones (1, length (ind));
     dest = ones (length (y), 1) * ind + repeat - 1;
-    t (dest) = y (repeat);
+    t(dest) = y(repeat);
   else                        # deletion
     ## Build an index vector of all locations where the target was found
     ## in the search string, and zap them. 
-    t = toascii(s);
+    t = toascii (s);
     repeat = [1:length(x)]' * ones (1, length (ind));
     delete = ones (length (x), 1) * ind + repeat - 1;
-    t (delete) = [];
-    t = setstr(t);
+    t(delete) = [];
+    t = setstr (t);
   endif
 
 endfunction
--- a/test/ChangeLog	Mon Jun 05 18:28:54 2000 +0000
+++ b/test/ChangeLog	Wed Jun 07 17:11:34 2000 +0000
@@ -1,3 +1,11 @@
+2000-06-07  Ben Sapp <bsapp@nua.lampf.lanl.gov>
+
+	* octave.test/quad/quad-1.m: Use absolute value of difference
+	from expected value when comparing with sqrt (eps).  Potential
+	problems like this were noticed by Przemek Klosowski
+	<przemek@rrdjazz.nist.gov>.
+	* octave.test/quad/quad-2.m: Likewise.
+
 1999-10-29  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* octave.test/system/mktime-1.m (t): Compare whole seconds only.
--- a/test/octave.test/quad/quad-1.m	Mon Jun 05 18:28:54 2000 +0000
+++ b/test/octave.test/quad/quad-1.m	Wed Jun 07 17:11:34 2000 +0000
@@ -1,3 +1,3 @@
 function y = f (x) y = x + 1; endfunction
 [v, ier, nfun, err] = quad ("f", 0, 5);
-ier == 0 && v - 17.5 < sqrt (eps) && nfun > 0 && err < sqrt (eps)
+ier == 0 && abs (v - 17.5) < sqrt (eps) && nfun > 0 && err < sqrt (eps)
--- a/test/octave.test/quad/quad-2.m	Mon Jun 05 18:28:54 2000 +0000
+++ b/test/octave.test/quad/quad-2.m	Wed Jun 07 17:11:34 2000 +0000
@@ -2,4 +2,4 @@
   y = x .* sin (1 ./ x) .* sqrt (abs (1 - x));
 endfunction
 [v, ier, nfun, err] = quad ("f", 0, 3);
-(ier == 0 || ier == 1) && v - 1.98194122455795 < sqrt (eps) && nfun > 0
+(ier == 0 || ier == 1) && abs (v - 1.98194122455795) < sqrt (eps) &&