CDbl (function)

Syntax

CDbl(expression)

Description

Converts any expression to a Double.

Comments

This function accepts any expression convertible to a Double, including strings. A runtime error is generated if expression is Null. Empty is treated as 0.0.

When passed a numeric expression, this function has the same effect as assigning the numeric expression number to a Double.

When used with variants, this function guarantees that the variant will be assigned a Double (VarType 5).

Example

This example displays the result of two numbers as a Double.

Sub Main()

  i% = 100
  j! = 123.44
  MsgBox "The double value is: " & CDbl(i% * j!)
End Sub

See Also

CCur (function); CBool (function); CDate, CVDate (functions); CInt (function); CLng (function); CSng (function); CStr (function); CVar (function); CVErr (function); Double (data type).

More information

C