Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

StdMaths.h

Go to the documentation of this file.
00001 
00002 /*
00003     TEDDY - General graphics application library
00004     Copyright (C) 1999-2002  Timo Suoranta
00005     tksuoran@cc.helsinki.fi
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2.1 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020     
00021     $Id:  $
00022 */
00023 
00024 
00031 #ifndef TEDDY__SYS_SUPPORT__STD_MATHS__H
00032 #define TEDDY__SYS_SUPPORT__STD_MATHS__H
00033 
00034 
00035 #if defined(_MSC_VER)
00036 # pragma warning(disable:4786)
00037 #endif
00038 
00039 
00040 #ifdef __cplusplus  /*  C/C++  */
00041 
00042 
00043 /*
00044 extern "C" {
00045 #include <math.h>
00046 #include <float.h>
00047 #include <limits.h>
00048 #include <string.h>
00049 #include <stdlib.h>
00050 } */
00051 
00052 #ifndef SWIG
00053 #include <cmath>
00054 #include <cfloat>
00055 #include <climits>
00056 #include <cstring>
00057 #include <cstdlib>
00058 #endif
00059 
00060 
00061 namespace Teddy      {
00062 namespace SysSupport {
00063 
00064 
00065 #undef  M_PI
00066 #undef  M_2_PI
00067 #define M_PI          ( 3.14159265358979323846264338327950288419716939937510)
00068 #define M_2_PI        ( 2*M_PI)
00069 #define M_HALF_PI     (M_PI/2)
00070 #define DEGS_PER_RAD  (57.29577951308232286465)
00071 #define RADS_PER_DEG  ( 0.01745329251994329547)
00072 #define degs(x)       (x*DEGS_PER_RAD)
00073 #define rads(x)       (x*RADS_PER_DEG)
00074 
00075 /*
00076 #if !defined( min )
00077 # define min(a,b) (a<b?a:b)
00078 #endif
00079 #if !defined( max )
00080 # define max(a,b) (a>b?a:b)
00081 #endif
00082 */
00083 
00084 #if !defined(_MSC_VER)
00085 # define acosf(x) (float)(acos(x))
00086 # define cosf(x)  (float)(cos(x))
00087 # define sinf(x)  (float)(sin(x))
00088 # define sqrtf(x) (float)(sqrt(x))
00089 #endif
00090 
00091 #if defined(_MSC_VER)
00092 # define isnan _isnan
00093 #else
00094 # ifndef isnan
00095 #  define isnan __isnan
00096 # endif
00097 #endif
00098 
00099 
00100 #ifndef MIN
00101 #define MIN(a,b) ((a)<(b)?(a):(b))
00102 #endif
00103 #ifndef MAX
00104 #define MAX(a,b) ((a)>(b)?(a):(b))
00105 #endif
00106 
00107 
00108 };  /*  namespace SysSupport  */
00109 };  /*  namespace Teddy  */
00110 
00111 
00112 #else  /*  C/C++ == C */
00113 
00114 #ifndef SWIG
00115 #include <math.h>
00116 #include <float.h>
00117 #include <limits.h>
00118 #include <string.h>
00119 #include <stdlib.h>
00120 #endif
00121 #undef  M_PI
00122 #undef  M_2_PI
00123 #define M_PI          ( 3.14159265358979323846264338327950288419716939937510)
00124 #define M_2_PI        ( 2*M_PI)
00125 #define M_HALF_PI     (M_PI/2)
00126 #define DEGS_PER_RAD  (57.29577951308232286465)
00127 #define RADS_PER_DEG  ( 0.01745329251994329547)
00128 #define degs(x)       (x*DEGS_PER_RAD)
00129 #define rads(x)       (x*RADS_PER_DEG)
00130 
00131 /*
00132 #if !defined( min )
00133 # define min(a,b) (a<b?a:b)
00134 #endif
00135 #if !defined( max )
00136 # define max(a,b) (a>b?a:b)
00137 #endif
00138 */
00139 
00140 #if !defined(_MSC_VER)
00141 # define acosf(x) (float)(acos(x))
00142 # define cosf(x)  (float)(cos(x))
00143 # define sinf(x)  (float)(sin(x))
00144 # define sqrtf(x) (float)(sqrt(x))
00145 #endif
00146 
00147 #if defined(_MSC_VER)
00148 # define isnan _isnan
00149 #else
00150 # define isnan __isnan
00151 #endif
00152 
00153 #ifndef MIN
00154 #define MIN(a,b) ((a)<(b)?(a):(b))
00155 #endif
00156 #ifndef MAX
00157 #define MAX(a,b) ((a)>(b)?(a):(b))
00158 #endif
00159 
00160 
00161 #endif  /*  C/C++  */
00162 
00163 
00164 #endif  /*  TEDDY__SYS_SUPPORT__STD_MATHS__H  */
00165 
00166