Function Windows API Class

CoerceSingleToLong

Coerce a Single (precision floating-point) value into a Long (Integer) value. Return the Long value whose bytes have the same in-memory representation as the Single value vValue. Inverse of the CoerceLongToSingle Function.

Signature (Visual Basic / VBA)

Public Function CoerceSingleToLong( _
    ByVal vValue As Single _
    ) As Long

Code Example

    CoerceSingleToLong(1) = 1065353216
    CoerceSingleToLong(2) = 1073741824
    CoerceSingleToLong(1.401298E-45) = 1
    CoerceSingleToLong(2.802597E-45) = 2

Notes & Version History

Note Similar to but faster than using the MakeSingle and CoerceToLong functions.