why do you cast to int? Anyway, it should not loose precision.