C++ converting Variant Decimal to Double Value
问题 I have a _variant_t variable that contains a DECIMAL value from a database.. The problem is, I get an undefined value when I try to directly convert it to double type. For example, I have a decimal value = 1000.111 _varaint_t MyVar = getValueFromDatabase(); // MyVar is a decimal value = 1000.111 double MyDouble = (double) MyVar.dblVal; cout << MyDouble << endl; // Prints "4.941204871279e-318#DEN" What is the right way to convert Decimal to Double in C++? UPDATE: When I try this, _varaint_t