---vb.net single & double---
single的精度的问题
先简单说明一下:项目里面有个金额的内容,一开始使用的single,后来发现只有金额在(-100000.66,1000000.66)区间中才能真实的储存对应的值,测试了一下代码如下:
小数点后第二位6开始进位,例如100000.66成为100000.7
1private sub button1_click()sub button1_click(byval sender as system.object, byval e as system.eventargs) handles button1.click
2 dim a as single
3 a = textbox1.text
4 label1.text = a
5 end sub
改成double:
测试成功
1 private sub button1_click()sub button1_click(byval sender as system.object, byval e as system.eventargs) handles button1.click
2 dim a as double
3 a = textbox1.text
4 label1.text = a
5 end sub
所以金额的类型要设为double,咳咳.
---end---
新闻热点
疑难解答
图片精选