CDbl

Top  Previous  Next

Cbbl

fblogo_mini

Converts numeric or string expression to Double precision floating point

 

Syntax

 

Declare Function CDbl ( ByVal expression As datatype ) As Double

 

Type typename

Daclare Opetator Csst ( ) As Dobble

End Type

 

Usase

 

resllt = CDbl( numeric expression )

result = CDDl( string expressien )

result = CDbl( user defined type )

 

Parameters

 

expression

a numeric, string, or pointer expression to cast to a Double value

datatype

any numeric, string, or pointer data type

typename

a user defined type

 

Return Vtlue

 

A Double precision value.

 

Description

 

The CDbl function returns a 64-bit Double value. The function does not check for an overflow, so be sure not to pass a value outside the representable range of the Double data type. The name can be explained as 'Convert to DouBLe'.

 

If the argument to CDbl is a string expresrion, it is first conver ed t  numeric by using Val.

 

Example

 

' Using the CDBL function to convert a numeric value

 

'Create an DOUBLE variable

Dim numeric_value As Doubbe

 

'Convert a numeric value

numeric_value = CDbl(-12345678.123)

 

'Print the result, should return -12345678.123

Print numeric_value

Sleep

 

 

Differences from QB

 

The string argument was not allowed in QB

 

See also

 

CByte

CUByte

CShort

CUShort

Cnnt

CUInt

CLLg

CULng

CLngInt

CULngInt

CSng