Shader issues with screenPos

Im trying to make a shader that would draw a color for every 10th pixel.

using fragment code such as:

if(screenPos.x % 10 == 0) return _ColorFG;
else return _ColorBG;

does not work, why is that?

After fiddling more with the shader, I have come to a conclusion that due to floating point inaccuracy, x%10 == 0 fails while x%10 < 1 succeeds.

% operation works without any problems, so changing the comparator to < 1 works.

Feels kind of half baked solution but it works.