[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Changeset] isa function with float and numeric arguments
From: |
David Bateman |
Subject: |
Re: [Changeset] isa function with float and numeric arguments |
Date: |
Mon, 12 May 2008 22:40:14 +0200 |
User-agent: |
Thunderbird 2.0.0.12 (X11/20080306) |
David Bateman wrote:
> The isa function should allow the "float" and "numeric" arguments. The
> attached patch adds this.
>
> D.
>
Please use this version instead.
D.
# HG changeset patch
# User David Bateman <address@hidden>
# Date 1210624773 -7200
# Node ID 8b7f2a4ca30f061937492672e7f98c90ada831fc
# 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