CDbl
Coerces an expression to a Double.
Syntax: CDbl( expression )
- expression
- required Any valid string or numeric expression in the Double range —
-1.79769313486231E308to-4.94065645841247E-324for negative values, and4.94065645841247E-324to1.79769313486232E308for positive values.
The return type is Double. If expression is outside the range of a Double, a run-time error occurs.
CDbl is the internationally aware alternative to Val for converting a string to a numeric type. CDbl recognizes different decimal separators and different thousand separators properly, depending on the system’s locale setting.
Example
This example uses the CDbl function to convert an expression to a Double.
Dim MyCurr, MyDouble
MyCurr = CCur(234.456784) ' MyCurr is a Currency.
MyDouble = CDbl(MyCurr * 8.2 * 0.01) ' Convert result to a Double.