00001 /** @file rutz/compat_cmath.h Compatibility definitions for things missing from <cmath> */ 00002 00003 /////////////////////////////////////////////////////////////////////// 00004 // 00005 // Copyright (c) 2005-2007 University of Southern California 00006 // Rob Peters <rjpeters at usc dot edu> 00007 // 00008 // created: Mon Jan 16 18:16:40 2006 00009 // commit: $Id: compat_cmath.h 8249 2007-04-12 06:03:40Z rjpeters $ 00010 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/rutz/compat_cmath.h $ 00011 // 00012 // -------------------------------------------------------------------- 00013 // 00014 // This file is part of GroovX. 00015 // [http://www.klab.caltech.edu/rjpeters/groovx/] 00016 // 00017 // GroovX is free software; you can redistribute it and/or modify it 00018 // under the terms of the GNU General Public License as published by 00019 // the Free Software Foundation; either version 2 of the License, or 00020 // (at your option) any later version. 00021 // 00022 // GroovX is distributed in the hope that it will be useful, but 00023 // WITHOUT ANY WARRANTY; without even the implied warranty of 00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00025 // General Public License for more details. 00026 // 00027 // You should have received a copy of the GNU General Public License 00028 // along with GroovX; if not, write to the Free Software Foundation, 00029 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00030 // 00031 /////////////////////////////////////////////////////////////////////// 00032 00033 #ifndef GROOVX_RUTZ_COMPAT_CMATH_H_UTC20060117021640_DEFINED 00034 #define GROOVX_RUTZ_COMPAT_CMATH_H_UTC20060117021640_DEFINED 00035 00036 #include <cmath> 00037 00038 namespace rutz 00039 { 00040 double compat_m_pi(); 00041 double compat_m_pi_2(); 00042 double compat_m_e(); 00043 double compat_m_ln2(); 00044 } 00045 00046 00047 #ifdef MISSING_M_PI 00048 #define M_PI (rutz::compat_m_pi()) 00049 #endif 00050 00051 #ifdef MISSING_M_PI_2 00052 #define M_PI_2 (rutz::compat_m_pi_2()) 00053 #endif 00054 00055 #ifdef MISSING_M_E 00056 #define M_E (rutz::compat_m_e()) 00057 #endif 00058 00059 #ifdef MISSING_M_LN2 00060 #define M_LN2 (rutz::compat_m_ln2()) 00061 #endif 00062 00063 #ifdef MISSING_CBRT 00064 #define cbrt(x) (pow(x, 1.0/3.0)) 00065 #endif 00066 00067 #ifdef MISSING_ISNAN 00068 # if defined(HAVE_STD_ISNAN) 00069 template <class T> inline 00070 int isnan(T x) { return std::isnan(x); } 00071 # endif 00072 #endif 00073 00074 static const char __attribute__((used)) vcid_groovx_rutz_compat_cmath_h_utc20060117021640[] = "$Id: compat_cmath.h 8249 2007-04-12 06:03:40Z rjpeters $ $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/rutz/compat_cmath.h $"; 00075 #endif // !GROOVX_RUTZ_COMPAT_CMATH_H_UTC20060117021640DEFINED