关于实际计算是整数,但数值显示为何是小数问题
下面是一段代码,计算结果明明应该是整数,但是msgbox 显示的是小数。请高手指点下?我也试过把数据类型定义为double就没有问题,但是不明白为什么。
Private Sub Command2_Click()
Dim DiBankuandu As Single
DiBankuandu = 1.6
Dim TaiJiekuandu(1) As Single
TaiJiekuandu(0) = 1.8
TaiJiekuandu(1) = 1.8
a = 1.8
b = 1.8
For I = 0 To 1
DiBankuandu = DiBankuandu + 2 * TaiJiekuandu(I)
MsgBox DiBankuandu
Next
End Sub