Replace all hardcoded 1e30(f) by BT_LARGE_FLOAT, defined in btScalar.h as 1e18(f) so that its square still fits in FLT_MAX

Thanks to Ole K. for reporting! http://code.google.com/p/bullet/issues/detail?id=206
This commit is contained in:
erwin.coumans
2009-05-23 02:15:54 +00:00
parent 1e11223f6b
commit badf723257
51 changed files with 127 additions and 124 deletions

View File

@@ -168,8 +168,12 @@ inline int btGetVersion()
///The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision.
#if defined(BT_USE_DOUBLE_PRECISION)
typedef double btScalar;
//this number could be bigger in double precision
#define BT_LARGE_FLOAT 1e30
#else
typedef float btScalar;
//keep BT_LARGE_FLOAT*BT_LARGE_FLOAT < FLT_MAX
#define BT_LARGE_FLOAT 1e18f
#endif

View File

@@ -488,7 +488,7 @@ public:
SIMD_FORCE_INLINE int maxAxis4() const
{
int maxIndex = -1;
btScalar maxVal = btScalar(-1e30);
btScalar maxVal = btScalar(-BT_LARGE_FLOAT);
if (m_floats[0] > maxVal)
{
maxIndex = 0;
@@ -521,7 +521,7 @@ public:
SIMD_FORCE_INLINE int minAxis4() const
{
int minIndex = -1;
btScalar minVal = btScalar(1e30);
btScalar minVal = btScalar(BT_LARGE_FLOAT);
if (m_floats[0] < minVal)
{
minIndex = 0;