bpmnr/nr_checks.c

Go to the documentation of this file.
00001 
00005 #include <bpm/bpm_messages.h>
00006 #include <bpm/bpm_nr.h>
00007 
00008 
00021 int nr_is_int( double x ) {
00022 
00023   if( ABS( x - (int) x ) == 0. ) return TRUE;
00024   
00025   return FALSE;
00026 }
00027 
00028 // -----------------------------------------------------------------------------
00029 
00039 int nr_is_pow2( unsigned long n ) {
00040 
00041   int p = 0;
00042   int r = 0;
00043 
00044    do {
00045      r = n % 2;  n /= 2;  p++;
00046    } while ( r == 0 && n > 1 );
00047 
00048    if( r != 0 ) return FALSE;
00049 
00050    return p;
00051 }
00052 

Generated on Thu Jan 10 10:18:04 2008 for libbpm by  doxygen 1.5.1