Function Coerce Make Class

MakeSingle

"Make String From Single" or "Coerce Single To String" Coerce a Single (precision floating-point numeric) value into a 4-character string. Return a four-character string containing the in-memory representation of the Single value vValue. Similar to coercing a float value into character string in the C language. Same as the MKS function in earlier versions of Microsoft Basic. Inverse of the CoerceToSingle function.

Signature (Visual Basic / VBA)

Public Function MakeSingle( _
    ByVal vValue As Variant _
    ) As Variant

Code Example

    MakeSingle(0) = Chr$(0) + Chr$(0) + Chr$(0) + Chr$(0)
    MakeSingle(1) = Chr$(0) + Chr$(0) + Chr$(128) + Chr$(63)
    MakeSingle(2) = Chr$(0) + Chr$(0) + Chr$(0) + Chr$(64)
    MakeSingle(2.5) = Chr$(0) + Chr$(0) + Chr$(32) + Chr$(64)
    MakeSingle("2") = Chr$(0) + Chr$(0) + Chr$(0) + Chr$(64)
    IsNull(MakeSingle(Null)) = True

Parameters

Parameter Description
vValue The Single (precision floating-point numeric) value whose bytes are to be interpreted as a string. vValue can be a numeric value, a date value, a numeric string, or a date string. Function returns Null if vValue is Null. Function returns an empty string if vValue cannot be fixed up to a number.

Notes & Version History

Note This function converts the string representation of the value to Unicode using the default code page of the system.
v1.3 Change Removed 16-bit support from this function.