Scripting > UNICOM Intelligence Function Library > Conversion functions > CDouble
 
CDouble
Converts a value of any data type to a Double value.
Syntax
CDouble(Val)
Parameters
Val
Type: None
Variant value to be converted.
(return)
Type: Double
Double value derived from Val.
Remarks
This function is similar to CDbl in Visual Basic.
The result of the conversion depends on the data type of Val, as follows:
Boolean
The return value is 1.0 (True) or 0.0 (False).
Long
The return value is equal to Val, with a fractional part of zero.
Double
Val is returned unchanged.
Date
The return value is the floating-point number used internally to represent the date.
Text
The string is parsed according to the locale to extract the value. An error occurs if the string does not contain a properly formatted double.
Categorical
An error occurs.
Object
If the object has a default property, the value of that property is converted. Otherwise an error occurs.
NULL values
If Val is NULL, the return value is 0.0.
Examples
Data type
Value
Result
Boolean
True
1.0
Long
345
345.0
Double
56.798
56.798
Text
14 April 2001 20:30:02
36995.8541898148
Text
Fossils
Error
Categorical
{5,3,1,9}
Error
See also
CBoolean
Conversion functions