<-- Previous || Up || Next -->

Coerce To Single Function
Coerce Make Class

Public Function CoerceToSingle( _
    ByVal vString As Variant _
    ) As Variant

"Coerce String To Single"
Return the Single (precision floating-point numeric) value whose in-memory representation is the same as the first four characters in string vString.
Same as the CVS function in earlier versions of Microsoft Basic.
Inverse of the MakeSingle (MKS) function.

Examples:
    CoerceToSingle(String$(8, 0)) = 0!
    CoerceToSingle(String$(8, 1)) = 2.369428E-38!
    CoerceToSingle(String$(8, 2)) = 9.551468E-38!
    IsNull(CoerceToSingle(Null)) = True
See also:
    CoerceToSingleFast Function
    MakeSingle Function
    CoerceToVarType Function
    CoerceToDouble Function
vString: The string whose first four characters are to be interpreted as a Single value. Function returns Null if vString is Null or cannot be fixed up to a String.

Note: Function generates the Visual Basic Error "Illegal Function Call" if vString is less than 4 characters long (the size of a Single value).
Note: If vString is more than four characters long, the leftmost four characters are coerced to a Single value.

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

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.