.net - CInt does not round Double value consistently - how can I remove the fractional part? -
i've stumbled upon issue cint , converting double integer.
the issue following:
cint(10.5) 'result 10 cint(10.51) 'result 11, expected 10...
i got used c# style conversion (int) 10.51
10.
as pointed out in question integer.parse vs cint, result rounded in fashion.
however, need integer part , throw away fractional one. how can achieve such type of conversion in vb.net? after research see can use fix()
function trick, best choice?
you may use int
or fix
functions return value type of these functions double have convert integer if option strict
on
.
no = convert.toint32(int(10.51))
Comments
Post a Comment