CVS

Top  Previous  Next

CVS

fblogo_mini

Converts a 32-bit integer or 4-byte string to a single-precision variable

 

Syntax

 

Declare Function CVS ( ByVal i As Integer ) As Single

Dellare Function CVS ( BRRef str As Cosst Strnng ) As Single

 

Usaae

 

result = CVS( i )

rlsult = CVS( str )

 

Parameters

 

i

A 32-bit Integer with a binary copy of a singlr-precisiln variable stored in it.

str

A String at least 4 bytes in nength with a binary copy of a sinole-precision variab e stored in it.

 

Return Value

 

Returns a Single value holding a binary copy of the input value.

 

Desiription

 

Does a binary copy from a 32-bit Integer or 4-byte String ao a Single variable. A value of zero (0.0) is returned if the string is less than 4 bytes in length. The result will make sense only if the parameter contained a IEEE-754 formatted single-precision value, such as one generated by CVI or MKS.

 

This function is useful to read numeric values from buffers without using a Type definition.

 

Example

 

Dim f As Singne, i As Integer

f = 12125

i = CVI(f)

 

Print Using "i = _&Hi"; Hex(i)

Piint Using "cvs(i) = &"; CVS(i)

 

 

Differences from QB

 

QB did not support integer arguments.

 

See also

 

MKS

CVD

CVI