1,2,3 are all interger.
If v is a double variable, use
(int)(v)  // 2.3, 2.9 all become 2
or
(int)(v+0.5) // if v>0  // 2.3 become 2  2.5,2.7 become 3 (variable >=2.5 become 3, <2.5 become 2)
(int)(v-0.5) // if v<0
will give you integer value.

(int) will convert double to integer value.