Converting double to hexadecimal - Code review
问题 I have the following code that takes a double value and converts it to a hexadecimal representation, and vice versa. I would like to know whether there are any potential problems with it - whether I have overlooked something. double hex_to_double2(string &hexString) { unsigned char byte_string[sizeof(double)]; int number; int j = 0; for(int i = 0; i < hexString.size() ; i += 2) { sscanf(&hexString[i], "%02x", &number); byte_string[j] = (unsigned char)number; ++j; } double p = (double&)byte