Did you notice the warning in your question? (Watch out for integer division). For 1/3 will get 0. You can change it to 1./3 or simply use .33333333
(Watch out for integer division)