Matt Gruenke wrote:
To access the native binary representation of floating-point type T, isn't it easier & safer to use a union of T and a character array with sizeof (T) elements?
1. Doing that is not legal. The C++ standard states that only one value in a union can be active at the same time time. And it may not work with some optimizing compilers. 2. For my purposes, I needed to copy the bits, and then make integer comparisons of the copied bits. Hence I copy the bits into integers. 3. For other purposes, using an array of char and memcpy might be best. Note that memcpy is very efficient. Both MSVC and GCC knows the meaning of memcpy and generates optimized code for the copying. A memcpy of 4 bytes will result in a single move instruction. --Johan