CDbl Function

Description

Converts an expression to a Double.

Syntax

CDbl(expression)

The expression argument is any valid numeric or string expression.

Remarks

In general, you can document your code using the data type conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CDbl or CSng to force double- or single-precision arithmetic in cases where currency or integer arithmetic normally would occur.

You should use the CDbl function instead of Val to provide internationally-aware conversions from any other data type to a Double. For example, different decimal separators and thousands separators are properly recognized depending on the locale setting of your system.

See Also

Data Type Summary.

Example

This example uses the CDbl function to convert an expression to a Double.


MyCurr = CCur(234.456784)    ' MyCurr is a Currency.
MyDouble = CDbl(MyCurr * 8.2 * 0.01)    ' Convert result to Double.