Enclosed is a suggested patch for making the isnan() and finite() functions
available in the Compute module. These functions accept TYPE_FLOAT and
TYPE_DOUBLE of CATEGORY_REAL as well as TYPE_FLOAT/CATEGORY_COMPLEX input
and returns an integer reflecting the outcome of the underlying call to
the isnan() and finite() functions of the math library.

The documentation update is rudimentary as I am not quite sure if the html
and help files are the right place to edit this kind of information or if 
these pages are generated from some other master documentation.

This is mostly a cut-and-paste fix generated from the tanh and abs functions, 
but it appears to work.

Cheers,

/Nils
-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   Nils Smeds                        http://www.pdc.kth.se/
   Center for Parallel Computers     e-mail: [EMAIL PROTECTED]
   Royal Institute of Technology     Voice:  +46-8-7909115
   KTH                               Fax:    +46-8-247784 
   S-100 44 Stockholm, Sweden        Office: OB2, room 1546
-----------------------------------------------------------------------

Index: CVSMake
===================================================================
RCS file: /src/master/dx/CVSMake,v
retrieving revision 1.1
diff -p -r1.1 CVSMake
*** CVSMake     5 Jan 2000 22:56:36 -0000       1.1
--- CVSMake     9 Sep 2002 23:11:38 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ #!/bin/sh -x
  # These are the steps that must be done after a make maintainer-clean
  # in order to ./configure this package.
  
Index: help/dxall795
===================================================================
RCS file: /src/master/dx/help/dxall795,v
retrieving revision 1.1
diff -p -r1.1 dxall795
*** help/dxall795       5 Feb 2002 21:21:06 -0000       1.1
--- help/dxall795       9 Sep 2002 23:11:39 -0000
*************** base 10--see Note 1), exp(a) TAB float, 
*** 80,87 ****
  Functions TAB #!N TAB - TAB +a, -a (negation) TAB any 
  type #!N TAB Binary Functions TAB #!N TAB - TAB a+b, 
  a-b, a*b, a/b, a%b (modulus--see Note 1), TAB #!N TAB - 
! TAB a^b or a**b (exponentiation--see Note 4) TAB any type #!N 
! TAB Vector Functions (see Note 1) TAB #!N TAB - TAB 
  a dot b or dot(a, b) TAB float vector #!N TAB 
  - TAB a cross b or cross(a,b) TAB float 3-vector #!N 
  TAB - TAB mag(a) TAB double, float vector #!N TAB - 
--- 80,89 ----
  Functions TAB #!N TAB - TAB +a, -a (negation) TAB any 
  type #!N TAB Binary Functions TAB #!N TAB - TAB a+b, 
  a-b, a*b, a/b, a%b (modulus--see Note 1), TAB #!N TAB - 
! TAB a^b or a**b (exponentiation--see Note 4) TAB any type 
! #!N TAB IEEE inquiry functions (result is integer)TAB 
! #!N TAB - TAB isnan(a), finite(a) TAB float, double 
! #!N TAB Vector Functions (see Note 1) TAB #!N TAB - TAB 
  a dot b or dot(a, b) TAB float vector #!N TAB 
  - TAB a cross b or cross(a,b) TAB float 3-vector #!N 
  TAB - TAB mag(a) TAB double, float vector #!N TAB - 
Index: html/pages/refgu036.htm
===================================================================
RCS file: /src/master/dx/html/pages/refgu036.htm,v
retrieving revision 1.5
diff -p -r1.5 refgu036.htm
*** html/pages/refgu036.htm     1 Mar 2002 07:19:09 -0000       1.5
--- html/pages/refgu036.htm     9 Sep 2002 23:11:40 -0000
*************** Note 1), exp(a)
*** 214,219 ****
--- 214,226 ----
  <P>
  &nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="27%">&nbsp;float, double
  &nbsp;</TD></TR><TR>
+ <TD ALIGN="LEFT" VALIGN="TOP" COLSPAN="2"><B>IEEE inquiry functions
+ </B></TD><TD ALIGN="LEFT" VALIGN="TOP"><B><BR></B></TD></TR><TR>
+ <TD ALIGN="LEFT" VALIGN="TOP" WIDTH="4%">&nbsp;&nbsp;
+ &nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="69%">&nbsp;isnan(a), finite(a)
+ &nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="27%">&nbsp;float, double
+ <P>
+ &nbsp;</TD></TR><TR>
  <TD ALIGN="LEFT" VALIGN="TOP" COLSPAN="2"><B>Unary Functions
  </B></TD><TD ALIGN="LEFT" VALIGN="TOP"><B><BR></B></TD></TR><TR>
  <TD ALIGN="LEFT" VALIGN="TOP" WIDTH="4%">&nbsp;&nbsp;
*************** WarpingPositions.net
*** 593,596 ****
                        <P></P>
                </DIV>
                <P></P>
!       </BODY></HTML>
\ No newline at end of file
--- 600,603 ----
                        <P></P>
                </DIV>
                <P></P>
!       </BODY></HTML>
Index: src/exec/dxmods/_compcmplx.c
===================================================================
RCS file: /src/master/dx/src/exec/dxmods/_compcmplx.c,v
retrieving revision 1.3
diff -p -r1.3 _compcmplx.c
*** src/exec/dxmods/_compcmplx.c        10 May 1999 15:45:16 -0000      1.3
--- src/exec/dxmods/_compcmplx.c        9 Sep 2002 23:11:41 -0000
*************** _dxfComputeTanhComplexFloat(complexFloat
*** 211,216 ****
--- 211,232 ----
  
      return result;
  }
+ int
+ _dxfComputeIsnanComplexFloat(complexFloat x)
+ {
+     int result;
+ 
+     result = isnan(REAL(x)) || isnan(IMAG(x));
+     return result;
+ }
+ int
+ _dxfComputeFiniteComplexFloat(complexFloat x)
+ {
+     int result;
+ 
+     result = finite(REAL(x)) && finite(IMAG(x));
+     return result;
+ }
  complexFloat
  _dxfComputeAsinComplexFloat(complexFloat x)
  {
Index: src/exec/dxmods/_compoper.c
===================================================================
RCS file: /src/master/dx/src/exec/dxmods/_compoper.c,v
retrieving revision 1.8
diff -p -r1.8 _compoper.c
*** src/exec/dxmods/_compoper.c 21 Mar 2002 02:57:25 -0000      1.8
--- src/exec/dxmods/_compoper.c 9 Sep 2002 23:11:43 -0000
*************** VFUNC1 (tanF, float, float, ftan)
*** 2621,2626 ****
--- 2621,2628 ----
  VFUNC1 (sinhF, float, float, fsinh)
  VFUNC1 (coshF, float, float, fcosh)
  VFUNC1 (tanhF, float, float, ftanh)
+ VFUNC1 (finiteF, int, float, finite)
+ VFUNC1 (isnanF, int, float, isnan)
  
  VFUNC1 (sinD, double, double, sin)
  VFUNC1 (cosD, double, double, cos)
*************** VFUNC1 (tanD, double, double, tan)
*** 2628,2633 ****
--- 2630,2637 ----
  VFUNC1 (sinhD, double, double, sinh)
  VFUNC1 (coshD, double, double, cosh)
  VFUNC1 (tanhD, double, double, tanh)
+ VFUNC1 (finiteD, int, double, finite)
+ VFUNC1 (isnanD, int, double, isnan)
  
  VFUNC1 (sinFC, complexFloat, complexFloat, _dxfComputeSinComplexFloat)
  VFUNC1 (cosFC, complexFloat, complexFloat, _dxfComputeCosComplexFloat)
*************** VFUNC1 (tanFC, complexFloat, complexFloa
*** 2635,2640 ****
--- 2639,2646 ----
  VFUNC1 (sinhFC, complexFloat, complexFloat, _dxfComputeSinhComplexFloat)
  VFUNC1 (coshFC, complexFloat, complexFloat, _dxfComputeCoshComplexFloat)
  VFUNC1 (tanhFC, complexFloat, complexFloat, _dxfComputeTanhComplexFloat)
+ VFUNC1 (finiteFC, int, complexFloat, _dxfComputeFiniteComplexFloat)
+ VFUNC1 (isnanFC, int, complexFloat, _dxfComputeIsnanComplexFloat)
  #define FPM1(x) ((x) >= -1 && (x) <= 1)
  VFUNC1RC (asinF, float, float, fasin, FPM1, "#12060")
  VFUNC1RC (acosF, float, float, facos, FPM1, "#12061")
*************** static OperBinding tanhs[] = {
*** 2717,2722 ****
--- 2723,2750 ----
        {0, TYPE_FLOAT, CATEGORY_COMPLEX, 0},
        {   {0, TYPE_FLOAT, CATEGORY_COMPLEX, 0}}}
  };
+ static OperBinding isnans[] = {
+     {1, (CompFuncV)isnanF, _dxfComputeCheckSameShape,
+       {0, TYPE_INT, CATEGORY_REAL, 0},
+       {   {0, TYPE_FLOAT, CATEGORY_REAL, 0}}},
+     {1, (CompFuncV)isnanD, _dxfComputeCheckSameShape,
+       {0, TYPE_INT, CATEGORY_REAL, 0},
+       {   {0, TYPE_DOUBLE, CATEGORY_REAL, 0}}},
+     {1, (CompFuncV)isnanFC, _dxfComputeCheckSameShape,
+       {0, TYPE_INT, CATEGORY_REAL, 0},
+       {   {0, TYPE_FLOAT, CATEGORY_COMPLEX, 0}}}
+ };
+ static OperBinding finites[] = {
+     {1, (CompFuncV)finiteF, _dxfComputeCheckSameShape,
+       {0, TYPE_INT, CATEGORY_REAL, 0},
+       {   {0, TYPE_FLOAT, CATEGORY_REAL, 0}}},
+     {1, (CompFuncV)finiteD, _dxfComputeCheckSameShape,
+       {0, TYPE_INT, CATEGORY_REAL, 0},
+       {   {0, TYPE_DOUBLE, CATEGORY_REAL, 0}}},
+     {1, (CompFuncV)finiteFC, _dxfComputeCheckSameShape,
+       {0, TYPE_INT, CATEGORY_REAL, 0},
+       {   {0, TYPE_FLOAT, CATEGORY_COMPLEX, 0}}}
+ };
  static OperBinding asins[] = {
      {1, (CompFuncV)asinF, _dxfComputeCheckSameShape,
        {0, TYPE_FLOAT, CATEGORY_REAL, 0},
*************** static OperDesc operators[] = {
*** 3389,3395 ****
      OP_RECORD_SIZE (FUNC_uint,        "uint",         _dxdComputeUints, 
_dxdComputeUintsSize),
      OP_RECORD_SIZE (FUNC_ushort, "ushort",    _dxdComputeUshorts, 
_dxdComputeUshortsSize),
      OP_RECORD (OPER_ASSIGNMENT, "assignment", assignments),
!     OP_RECORD (OPER_VARIABLE, "variable", variables)
  };
  
      
--- 3417,3425 ----
      OP_RECORD_SIZE (FUNC_uint,        "uint",         _dxdComputeUints, 
_dxdComputeUintsSize),
      OP_RECORD_SIZE (FUNC_ushort, "ushort",    _dxdComputeUshorts, 
_dxdComputeUshortsSize),
      OP_RECORD (OPER_ASSIGNMENT, "assignment", assignments),
!     OP_RECORD (OPER_VARIABLE, "variable", variables),
!     OP_RECORD (FUNC_finite,   "finite",  finites),
!     OP_RECORD (FUNC_isnan,    "isnan",  isnans)
  };
  
      
*************** _dxfComputeLookupFunction (char *name)
*** 4056,4062 ****
        { "stricmp",    FUNC_stricmp },
        { "strstr",     FUNC_strstr },
        { "stristr",    FUNC_stristr },
!       { "strlen",     FUNC_strlen }
      };
      int i;
  
--- 4086,4094 ----
        { "stricmp",    FUNC_stricmp },
        { "strstr",     FUNC_strstr },
        { "stristr",    FUNC_stristr },
!       { "strlen",     FUNC_strlen },
!       { "finite",     FUNC_finite },
!       { "isnan",      FUNC_isnan }
      };
      int i;
  
Index: src/exec/dxmods/_compoper.h
===================================================================
RCS file: /src/master/dx/src/exec/dxmods/_compoper.h,v
retrieving revision 1.4
diff -p -r1.4 _compoper.h
*** src/exec/dxmods/_compoper.h 24 Aug 2000 20:04:09 -0000      1.4
--- src/exec/dxmods/_compoper.h 9 Sep 2002 23:11:43 -0000
*************** typedef struct {
*** 91,96 ****
--- 91,98 ----
  #define FUNC_strlen   (LAST_OPER+ 57)
  #define FUNC_strstr   (LAST_OPER+ 58)
  #define FUNC_stristr  (LAST_OPER+ 59)
+ #define FUNC_finite   (LAST_OPER+ 60)
+ #define FUNC_isnan    (LAST_OPER+ 61)
  
  typedef struct {
      float realPart;
*************** complexFloat _dxfComputeSinhComplexFloat
*** 1468,1473 ****
--- 1470,1477 ----
  complexFloat _dxfComputeCoshComplexFloat(complexFloat x);
  complexFloat _dxfComputeTanComplexFloat(complexFloat x);
  complexFloat _dxfComputeTanhComplexFloat(complexFloat x);
+ int _dxfComputeFiniteComplexFloat(complexFloat x);
+ int _dxfComputeIsnanComplexFloat(complexFloat x);
  complexFloat _dxfComputeAsinComplexFloat(complexFloat x);
  complexFloat _dxfComputeAcosComplexFloat(complexFloat x);
  complexFloat _dxfComputeAtanComplexFloat(complexFloat x);

Reply via email to