“Floating-point invalid operation” when inputting float to a stringstream
问题 I have a simple piece of code that extracts a float from a FORTRAN-generated REAL array, and then inserts it into a stream for logging. Although this works for the first 30 cases, on the 31st it crashes with a "Floating-point invalid operation". The code is: int FunctionDeclaration(float* mrSwap) { ... float swap_float; stringstream message_stream; ... swap_float = *(mrSwap+30-1); ... message_stream.clear(); message_stream << 30 << "\t" << swap_float << "\tblah blah blah \t"; When debugging,