finite.c

Go to the documentation of this file.
00001 #include "machine.h"
00002 
00003 #if !(defined HAVE_FINITE) && (defined hppa)
00004 
00005 #include <math.h>
00006 
00007 int finite(double x)
00008 {
00009   if (isfinite(x)==0) return 0;
00010   return 1;
00011 }
00012 
00013 #else
00014 #if !(defined HAVE_FINITE)
00015 
00016 typedef unsigned int __uint32_t;
00017 typedef union 
00018 {
00019   struct 
00020   {
00021     __uint32_t lsw;
00022     __uint32_t msw;
00023   } parts;
00024   double value;
00025 } ieee_double_shape_type;
00026 
00027 #ifdef __STDC__
00028 int finite(double x)
00029 #else
00030 int finite(x)
00031 double x;
00032 #endif
00033 {
00034   int hx;
00035   ieee_double_shape_type gh_u;
00036   
00037   gh_u.value = x;
00038   hx = gh_u.parts.msw;
00039   return  (int)((__uint32_t)((hx&0x7fffffff)-0x7ff00000)>>31);
00040 }
00041 #endif
00042 #endif

Generated on Sun Mar 4 15:03:48 2007 for Scilab [trunk] by  doxygen 1.5.1