DataCast

Converts or casts a value from one data type to another.

Syntax:

DataCast( value, mode )

Parameters:

(f) value: specifies the value to be converted or cast.

(i) mode: specifies the operation to perform:

Returns:

(f)  depends on mode specified. See below.

 

Mode

Meaning

0

Cast single-precision floating point to double-precision floating point.

"value" specifies a single-precision (32-bit) floating point value, represented as a WIL long value containing the same bit sequence as the float value.

Returns a WIL floating point value (64-bit).

1

Cast double-precision floating point to single-precision floating point.

"value" specifies a WIL floating point value (64-bit).

Returns a single-precision (32-bit) floating point value, represented as a WIL long value containing the same bit sequence as the float value.

 

Casting a value involves changing it from one data type to another, and may involve a loss of precision depending on the type of cast.

Example:


single_precision = 1077936128
;Cast single-precision floating point to double-precision floating point. double_precision = DataCast(single_precision,0) Message(single_precision, double_precision)
;Cast double-precision floating point to single-precision floating point. single_precision = DataCast(double_precision,1) Message(double_precision, single_precision )
See Also:

DllCall, DllCallCdecl