ShortFloat.st
changeset 7419 44b2f66791f1
parent 7408 43bd10f2f2e6
child 7437 834ea4d6cdbc
equal deleted inserted replaced
7418:521174de046d 7419:44b2f66791f1
    61 #ifdef WIN32
    61 #ifdef WIN32
    62 /*
    62 /*
    63  * no finite(x) ?
    63  * no finite(x) ?
    64  * no isnan(x) ?
    64  * no isnan(x) ?
    65  */
    65  */
    66 # ifndef finite 
    66 # ifndef isnan
    67 #  define finite(x)     1
    67 #  define isnan(x)      \
       
    68         ((((unsigned int *)(&x))[0] == 0x00000000) && \
       
    69          (((unsigned int *)(&x))[1] == 0xFFF80000))
    68 # endif
    70 # endif
    69 # ifndef isnan
    71 
    70 #  define isnan(x)      0
    72 # ifndef isnanf
       
    73 #  define isnanf(x)      \
       
    74         (((unsigned int *)(&x))[0] == 0xFFC00000)
    71 # endif
    75 # endif
       
    76 
       
    77 # ifndef isPositiveInfinity
       
    78 #  define isPositiveInfinity(x) \
       
    79         ((((unsigned int *)(&x))[0] == 0x00000000) && \
       
    80          (((unsigned int *)(&x))[1] == 0x7FF00000))
       
    81 # endif
       
    82 
       
    83 # ifndef isNegativeInfinity
       
    84 #  define isPositiveInfinity(x) \
       
    85         ((((unsigned int *)(&x))[0] == 0x00000000) && \
       
    86          (((unsigned int *)(&x))[1] == 0xFFF00000))
       
    87 # endif
       
    88 
       
    89 # ifndef isinf
       
    90 #  define isinf(x) \
       
    91         ((((unsigned int *)(&x))[0] == 0x00000000) && \
       
    92          ((((unsigned int *)(&x))[1] & 0x7FF00000) == 0x7FF00000))
       
    93 # endif
       
    94 
       
    95 # ifndef finite
       
    96 #  define finite(x) (!isinf(x) && !isnan(x))
       
    97 # endif
       
    98 
       
    99 # define NO_ASINH
       
   100 # define NO_ACOSH
       
   101 # define NO_ATANH
    72 #endif
   102 #endif
    73 
   103 
    74 #ifdef realIX
   104 #ifdef realIX
    75 /*
   105 /*
    76  * no finite(x)
   106  * no finite(x)
   627 
   657 
   628 %{  /* NOCONTEXT */
   658 %{  /* NOCONTEXT */
   629     float fVal;
   659     float fVal;
   630 
   660 
   631     fVal = __shortFloatVal(self);
   661     fVal = __shortFloatVal(self);
   632     if ((fVal >= (float)_MIN_INT) && (fVal <= (float)_MAX_INT)) {
   662 #ifdef WIN32
   633 	RETURN ( __MKSMALLINT( (INT)fVal) );
   663     if (! isnanf(fVal))    
       
   664 #endif
       
   665     {
       
   666         if ((fVal >= (float)_MIN_INT) && (fVal <= (float)_MAX_INT)) {
       
   667             RETURN ( __MKSMALLINT( (INT)fVal) );
       
   668         }
   634     }
   669     }
   635 %}.
   670 %}.
   636     ^ super asInteger
   671     ^ super asInteger
   637 
   672 
   638     "
   673     "
  1421 ! !
  1456 ! !
  1422 
  1457 
  1423 !ShortFloat class methodsFor:'documentation'!
  1458 !ShortFloat class methodsFor:'documentation'!
  1424 
  1459 
  1425 version
  1460 version
  1426     ^ '$Header: /cvs/stx/stx/libbasic/ShortFloat.st,v 1.78 2003-06-17 16:10:28 cg Exp $'
  1461     ^ '$Header: /cvs/stx/stx/libbasic/ShortFloat.st,v 1.79 2003-06-17 23:11:37 cg Exp $'
  1427 ! !
  1462 ! !