you dont have to use union in this task. 

double v = 0.0;
input.read( reinterpret_cast< char * >( &v ). sizeof( v ) );