I understand that INT and CINT dont round a double value the same way. One is rounding to the floor value, the other to nearest integer value. For instance :
Code: Select all
? int(6324.555320336759)
' = 6324
? cint(6324.555320336759)
' = 6325
'not like INT
Code: Select all
? cint("6324.555320336759")
' = 6324
'somehow similar to INT
But if I compare the returned types, acording to TYPEOF, CINT with the example will be INTEGER, while VALINT be LONG, and VALLNG, be LONGINT.If the argument is a string expression, it is converted to numeric by using ValInt or ValLng, depending on the size of the result type.
Code: Select all
? cint("6324.555320336759")
' = 6324 INTEGER
#print typeof(cint("6324.555320336759"))
? valint("6324.555320336759")
' = 6324 LONG
#print typeof(valint("6324.555320336759"))
? vallng("6324.555320336759")
' = 6324 LONGINT
#print typeof(vallng("6324.555320336759"))
So it'a little complicated. A simple warning would already help. My suggestion would be to add something like that at INT page:
The CINT page is more complicated so I don't know. I'm still playing with different scenarios to see what it gives.INT page
(additional remark)
Becareful, INT and CINT are not equivalent, see CINT for more informations.
And last thing. I guess that DIM AS INTEGER I = VALUE, uses CINT to coerce the value. But I'm not 100% sure.
Thanks.