.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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -