# Double 資料類型 (Visual Basic)Double Data Type (Visual Basic)

## 備註Remarks

Double資料類型會針對某個數位提供最大和最小的可能巨量。The Double data type provides the largest and smallest possible magnitudes for a number.

Double 的預設值為 0。The default value of Double is 0.

## 程式設計提示Programming Tips

• 精密.Precision. 當您使用浮點數時, 請記住它們不一定會在記憶體中有精確的標記法。When you work with floating-point numbers, remember that they do not always have a precise representation in memory. 這可能會導致某些作業產生非預期的結果, 例如值比較和Mod運算子。This could lead to unexpected results from certain operations, such as value comparison and the Mod operator. 如需詳細資訊, 請參閱針對資料類型進行疑難排解For more information, see Troubleshooting Data Types.

• 尾端零。Trailing Zeros. 浮點資料類型沒有尾端零字元的任何內部表示。The floating-point data types do not have any internal representation of trailing zero characters. 例如, 它們不會區分4.2000 和4.2。For example, they do not distinguish between 4.2000 and 4.2. 因此, 當您顯示或列印浮點值時, 不會出現尾端的零字元。Consequently, trailing zero characters do not appear when you display or print floating-point values.

• 輸入字元。Type Characters. 將常值類型字元 R 附加到常值，會強制其成為 Double 資料類型。Appending the literal type character R to a literal forces it to the Double data type. 例如, 如果整數值後面接著R, 則值會變更Double為。For example, if an integer value is followed by R, the value is changed to a Double.

' Visual Basic expands the 4 in the statement Dim dub As Double = 4R to 4.0:
Dim dub As Double = 4.0R


將識別項類型字元 # 附加到任何識別項，會強制其成為 DoubleAppending the identifier type character # to any identifier forces it to Double. 在下列範例中, 變數num的類型Double為:In the following example, the variable num is typed as a Double:

Dim num# = 3

• 架構類型。Framework Type. 在 .NET Framework 中對應的類型為 System.Double 結構。The corresponding type in the .NET Framework is the System.Double structure.