Denormal DOUBLE variables, macro¶
- Author or source: Jon Watte
- Created: 2002-03-17 15:44:31
Use this macro if you want to find denormal numbers and you're using doubles...
1 2 3 4 5 6 7 8 9 10 | #if PLATFORM_IS_BIG_ENDIAN
#define INDEX 0
#else
#define INDEX 1
#endif
inline bool is_denormal( double const & d ) {
assert( sizeof( d ) == 2*sizeof( int ) );
int l = ((int *)&d)[INDEX];
return (l&0x7fe00000) != 0;
}
|