math.hh

Go to the documentation of this file.
00001 // math.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2001, 2002, 2003, 2004 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00016 //
00017 #ifndef VCSN_CONFIG_MATH_HH
00018 # define VCSN_CONFIG_MATH_HH
00019 
00041 # include <vaucanson/config/system.hh>
00042 
00043 # include <cmath>
00044 
00045 # ifndef USE_C_LIMITS
00046 #  ifdef HAVE_LIMITS
00047 #   define USE_CXX_LIMITS
00048 #  endif
00049 # endif
00050 
00051 # ifdef NEED_SQRTF
00052 static inline float sqrtf(float f)
00053 {
00054   return (float)sqrt((double)f);
00055 }
00056 # endif
00057 
00058 # ifdef NEED_FLOORF
00059 static inline float floorf(float f)
00060 {
00061   return (float)floor((double)f);
00062 }
00063 # endif
00064 
00065 # ifdef NEED_ROUND
00066 static inline double round(double f)
00067 {
00068   return (f < 0.) ? -floor(-f + 0.5) : floor(f + 0.5);
00069 }
00070 # endif
00071 # ifdef NEED_ROUNDF
00072 static inline float roundf(float f)
00073 {
00074   return (f < 0.f) ? -floorf(-f + 0.5f) : floorf(f + 0.5f);
00075 }
00076 # endif
00077 
00078 #endif // ! VCSN_CONFIG_MATH_HH

Generated on Sat Jul 29 17:13:09 2006 for Vaucanson by  doxygen 1.4.6