pleyo.com

/src/trunk2/BAL/Interfaces/BIMath.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2007 Pleyo.  All rights reserved.
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  *
00008  * 1.  Redistributions of source code must retain the above copyright
00009  *     notice, this list of conditions and the following disclaimer.
00010  * 2.  Redistributions in binary form must reproduce the above copyright
00011  *     notice, this list of conditions and the following disclaimer in the
00012  *     documentation and/or other materials provided with the distribution.
00013  * 3.  Neither the name of Pleyo nor the names of
00014  *     its contributors may be used to endorse or promote products derived
00015  *     from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY PLEYO AND ITS CONTRIBUTORS "AS IS" AND ANY
00018  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00019  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00020  * DISCLAIMED. IN NO EVENT SHALL PLEYO OR ITS CONTRIBUTORS BE LIABLE FOR ANY
00021  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 #ifndef BIMATH_H_
00029 #define BIMATH_H_
00030 
00031 #ifndef __BAL_MATH_POSIX__
00032 #include <math.h>
00033 #else
00034 
00035 #ifdef _MATH_H
00036 # error "Never use <math.h> directly; include <BIMath.h> instead."
00037 #endif
00038 
00039 # define M_PI           3.14159265358979323846  /* pi */
00040 
00041 namespace BAL {
00042 
00049     class BIMath {
00050         public:
00051             // this is mandatory
00055             ~BIMath(){}
00056 
00060             static float ceilf(float );
00061             static double ceil(double );
00062 
00066             static float fmodf(float , float );
00067 
00071             static long int lroundf(float );
00072             static long int lround(double );
00073 
00077             static float floorf(float );
00078             static double floor(double );
00079 
00083             static float roundf(float );
00084             static double round(double );
00085 
00089             static double nextafter(double , double );
00090             static float nextafterf(float , float );
00091 
00095             static int isfinite(double );
00096 
00100             static double fabs(double );
00101 
00105             static double copysign(double , double );
00106 
00110             static double exp(double );
00111 
00115             static double log(double );
00116 
00120             static double sqrt (double );
00121 
00125             static double acos(double );
00126 
00130             static double asin(double );
00131 
00135             static double atan(double );
00136 
00140             static double atan2(double , double );
00141 
00145             static double cos(double );
00146 
00150             static double sin(double );
00151 
00155             static double tan(double );
00156 
00161             static int signbit( double  );
00162 
00166             static double pow(double , double );
00167 
00171             static double fmod(double , double );
00172 
00176             static double log10(double );
00177 
00181             static int isnan( double );
00182 
00186             static int isinf( double );
00187 
00191             static double remainder(double , double );
00192     };
00193 }
00194 
00195 inline float ceilf(float x)
00196 {
00197     return BAL::BIMath::ceilf( x );
00198 }
00199 
00200 inline float fmodf(float x, float y)
00201 {
00202     return BAL::BIMath::fmodf( x, y );
00203 }
00204 
00205 inline long int lroundf(float x)
00206 {
00207     return BAL::BIMath::lroundf( x );
00208 }
00209 
00210 inline float floorf(float x)
00211 {
00212     return BAL::BIMath::floorf( x );
00213 }
00214 
00215 inline float roundf(float x)
00216 {
00217     return BAL::BIMath::roundf( x );
00218 }
00219 
00220 inline double round(double x)
00221 {
00222     return BAL::BIMath::round( x );
00223 }
00224 
00225 inline long int lround(double x)
00226 {
00227     return BAL::BIMath::lround( x );
00228 }
00229 
00230 
00231 inline double nextafter(double x, double y)
00232 {
00233     return BAL::BIMath::nextafter( x, y );
00234 }
00235 
00236 inline float nextafterf(float x, float y)
00237 {
00238     return BAL::BIMath::nextafterf( x, y );
00239 }
00240 
00241 inline double floor(double x)
00242 {
00243     return BAL::BIMath::floor( x );
00244 }
00245 
00246 inline int isfinite(double x)
00247 {
00248     return BAL::BIMath::isfinite( x );
00249 }
00250 
00251 inline double fabs(double x)
00252 {
00253     return BAL::BIMath::fabs( x );
00254 }
00255 
00256 inline double copysign(double x, double y)
00257 {
00258     return BAL::BIMath::copysign( x, y );
00259 }
00260 
00261 
00262 inline double exp(double x)
00263 {
00264     return BAL::BIMath::exp( x );
00265 }
00266 
00267 inline double log(double x)
00268 {
00269     return BAL::BIMath::log( x );
00270 }
00271 
00272 inline double sqrt (double x)
00273 {
00274     return BAL::BIMath::sqrt( x );
00275 }
00276 
00277 inline double acos(double x)
00278 {
00279     return BAL::BIMath::acos( x );
00280 }
00281 
00282 inline double asin(double x)
00283 {
00284     return BAL::BIMath::asin( x );
00285 }
00286 
00287 inline double atan(double x)
00288 {
00289     return BAL::BIMath::atan( x );
00290 }
00291 
00292 inline double atan2(double y, double x)
00293 {
00294     return BAL::BIMath::atan2( y, x );
00295 }
00296 
00297 inline double ceil(double x)
00298 {
00299     return BAL::BIMath::ceil( x );
00300 }
00301 
00302 inline double cos(double x)
00303 {
00304     return BAL::BIMath::cos( x );
00305 }
00306 
00307 inline double sin(double x)
00308 {
00309     return BAL::BIMath::sin( x );
00310 }
00311 
00312 inline double tan(double x)
00313 {
00314     return BAL::BIMath::tan( x );
00315 }
00316 
00317 inline int signbit( double x )
00318 {
00319     return BAL::BIMath::signbit( x );
00320 }
00321 
00322 inline double pow(double x, double y)
00323 {
00324     return BAL::BIMath::pow( x, y );
00325 }
00326 
00327 inline double fmod(double x, double y)
00328 {
00329     return BAL::BIMath::fmod( x, y );
00330 }
00331 
00332 
00333 inline double log10(double x)
00334 {
00335     return BAL::BIMath::log10( x );
00336 }
00337 
00338 inline int isnan( double x)
00339 {
00340     return BAL::BIMath::isnan( x );
00341 }
00342 
00343 inline int isinf( double x)
00344 {
00345     return BAL::BIMath::isinf( x );
00346 }
00347 
00348 inline double remainder(double x, double y)
00349 {
00350     return BAL::BIMath::remainder( x, y );
00351 }
00352 
00353 
00354 const double HUGE_VAL = 0x7FF00000UL;
00355 const double NAN = 0x7FC00000UL;
00356 
00357 #endif // __MATH__
00358 #endif // BIMATH_H_

Generated on Wed Nov 21 20:04:16 2007 for Origyn Web Browser by Doxygen 1.5.3

pleyo.com
pleyo.com