Cast result as int to avoid error about conversion from double to int