'How to accurately multiply a COleCurrency by a double?

I have a COleCurrency object that represents a unit price. And I have a double value that represents a quantity. And I need to calculate the total dollar amount to the nearest penny.

Looks like COleCurrency has built in multiplication operators, but only for multiplication with a long value.

I can multiply COleCurrency.m_cur.int64 by the double, but that converts the double to __int64 so it wouldn't be accurate.

What is the best way to accurately multiply a COleCurrency by a double?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source