Function Windows API Class

CoerceDoubleToCurrency

Coerce a Double value into a Currency value. Return the Currency value whose bytes have the same in-memory representation as the Double value vValue. Inverse of the CoerceCurrencyToDouble Function.

Signature (Visual Basic / VBA)

Public Function CoerceDoubleToCurrency( _
    ByVal vValue As Double _
    ) As Currency

Code Example

    CoerceDoubleToCurrency(1) = 460718241880001.7408
    CoerceDoubleToCurrency(2) = 461168601842738.7904
    CoerceDoubleToCurrency(4.94065645841247E-320) = 1
    CoerceDoubleToCurrency(9.88131291682493E-320) = 2

Notes & Version History

Note Similar to but faster than using the MakeDouble and CoerceToCurrency functions.