如何检查asp.net中的浮点值? [英] How to check floating point value in asp.net?
本文介绍了如何检查asp.net中的浮点值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图比较我的代码中的浮动类型值,如
如果sum = 1.0则
代码语句true
else
代码语句false
结束如果
但有时发生的事情即使总和是1.0,那么
它转到else代码块。我如何解决这个问题?
I am trying to compare the floating type value in my code like
if sum=1.0 then
Code statements true
else
code statements false
end if
but what happened is sometimes even if the sum is 1.0 then also
it goes to else block of code . How do I solve this ?
推荐答案
浏览 http:/ /www.vb-helper.com/howto_net_compare_float.html [ ^ ]。
使用类似CStr(Math.Abs(sum-0)< 0.00001)
。
这篇关于如何检查asp.net中的浮点值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文