Using int and double in different places for this is kind of error prone. What about using int here as well and just do the conversion when we actually do the check?