【 tulaoshi.com - ASP.NET 】
---VB.NET Single & Double---single的精度的问题先简单说明一下:项目里面有个金额的内容,一开始使用的single,后来发现只有金额在(-100000.66,1000000.66)区间中才能真实的储存对应的值,测试了一下代码如下: 小数点后第二位6开始进位,例如100000.66成为100000.7
1
Private Sub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click2
Dim a As Single3
a = TextBox1.Text4
Label1.Text = a5
End Sub
改成Double:测试成功
1
Private Sub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click2
Dim a As Double3
a = TextBox1.Text4
Label1.Text = a5
End Sub
所以金额的类型要设为Double,咳咳.---end---