octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Changeset] isa function with float and numeric arguments


From: David Bateman
Subject: [Changeset] isa function with float and numeric arguments
Date: Mon, 12 May 2008 21:59:31 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20080306)

The isa function should allow the "float" and "numeric" arguments. The
attached patch adds this.

D.
# HG changeset patch
# User David Bateman <address@hidden>
# Date 1210622234 -7200
# Node ID 66f4246ff15c7258328c916663857d0fbbdd5e96
# Parent  b3ba72dfbb1bcce79fe839d70cb0c73e97c57fda
Treat numeric and float argument in the isa function.

diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@ 2008-05-09  David Bateman  <address@hidden
+2008-05-12  David Bateman  <address@hidden>
+
+       * general/isa.m: Also treat "float: and "numeric" as the class
+       argument.
+
 2008-05-09  David Bateman  <address@hidden>
 
        * testfun/assert.m: Allow assert(cond, errmsg, ...) and
diff --git a/scripts/general/isa.m b/scripts/general/isa.m
--- a/scripts/general/isa.m
+++ b/scripts/general/isa.m
@@ -30,6 +30,15 @@ function retval = isa (x, cname)
     print_usage ();
   endif
 
-  retval = strcmp (class (x), cname);
-
+  if (strcmp (cname, "float"))
+    retval = strcmp (class (x), "double") || strcmp (class (x), "single");
+  elseif (strcmp (cname, "fnumeric"))
+    retval = strcmp (class (x), "double") || strcmp (class (x), "single") ||
+    strcmp (class (x), "uint8") || strcmp (class (x), "uint16") ||
+    strcmp (class (x), "uint32") || strcmp (class (x), "uint64") ||
+    strcmp (class (x), "int8") || strcmp (class (x), "int16") ||
+    strcmp (class (x), "int32") || strcmp (class (x), "int64");
+  else
+    retval = strcmp (class (x), cname);
+  endif
 endfunction

reply via email to

[Prev in Thread] Current Thread [Next in Thread]