FMath/FMFloat.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005-2007 Feeling Software Inc.
00003     Portions of the code are:
00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
00005     
00006     MIT License: http://www.opensource.org/licenses/mit-license.php
00007 */
00008 
00014 #ifndef _FM_FLOAT_H_
00015 #define _FM_FLOAT_H_
00016 
00017 #if !defined(_INC_FLOAT) && (defined (WIN32) || defined (LINUX) || defined(__APPLE__))
00018 #include <float.h>
00019 #endif // _INC_FLOAT, WIN32 and LINUX
00020 
00022 #define DBL_TOLERANCE 0.0001
00023 
00024 #define FLT_TOLERANCE 0.0001f
00025 
00029 inline bool IsEquivalent(float f1, float f2) { return f1 - f2 < FLT_TOLERANCE && f2 - f1 < FLT_TOLERANCE; }
00030 
00035 inline bool IsEquivalent(float f1, float f2, float tolerance) { return f1 - f2 < tolerance && f2 - f1 < tolerance; }
00036 
00040 inline bool IsEquivalent(double f1, double f2) { return f1 - f2 < DBL_TOLERANCE && f2 - f1 < DBL_TOLERANCE; }
00041 
00046 inline bool IsEquivalent(double f1, double f2, double tolerance) { return f1 - f2 < tolerance && f2 - f1 < tolerance; }
00047 
00048 #ifndef FLT_MAX
00049 
00051 #define FLT_MAX __FLT_MAX__
00052 #endif
00053 
00054 #endif // _FM_FLOAT_H_
00055 

Generated on Thu Feb 14 16:58:35 2008 for FCollada by  doxygen 1.4.6-NO