Main Page | Class Hierarchy | Class List | File List | Class Members

misc.h

00001 /* 00002 * This file is part of libCP 00003 * FILE: misc.h 00004 * AUTHOR: Harald Studer <hs@lexip.ch> 00005 * Mathias Herzog <mathu@gmx.ch> 00006 * 00007 * 00008 * Copyright (c) 2004, The libCP project 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your opinion) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; see the file COPYING. If not, write to 00022 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00023 * Boston, MA 02111-1307, USA. 00024 */ 00025 #ifndef _MISC_H_ 00026 #define _MISC_H_ 00027 00028 #include <cmath> 00029 00030 namespace LIBCP{ 00031 00036 class Misc{ 00037 00038 public: 00044 static bool isPowerOfTwo( double number, int &m ) 00045 { 00046 m = (int)( log( number ) / log( 2.0 ) ); 00047 //cout << "m = " << m << endl; 00048 if( pow( 2.0, m ) != number ){ 00049 return false; 00050 } 00051 else{ 00052 return true; 00053 } 00054 } 00055 00056 }; 00057 00058 } //end of namespace Misc 00059 00060 #endif

Generated on Wed May 26 16:43:53 2004 for libcp by doxygen 1.3.7