# How to: Hold the Most Significant Digits in a Variable

**Visual Studio 2008**

A variable holds numbers with fractions if you declare it to be of data type Decimal.

A variable of the Decimal Data Type (Visual Basic) can hold numbers with 29 significant digits, including as many as 28 decimal places.

Performance. Decimal is the least efficient of the numeric data types. If you do not need the full precision of the Decimal data type, you can use the Double data type, which can hold as many as 18 significant digits. Operations with Double are faster than with Decimal, and Double variables take up less space in memory. For more information on Double, see How to: Hold Fractions in a Variable.

You should weigh the importance of precision against performance before choosing a data type.

Larger Magnitude. If you need your variable to hold numbers of greater magnitude than the Decimal data type can hold, you can use the Double or Single data type, each of which has a larger range. While Decimal variables can hold values up to 7.9228162514264337593543950335E+28, Single variables can hold up to 3.4028235E+38, and Double variables can hold up to 1.79769313486231570E+308.

### To hold the most significant digits in a variable

Declare the variable with a Dim Statement (Visual Basic).

Follow the variable name with an As clause.

Follow the As keyword with the Decimal keyword.