How to Obtain Pixel Perfect with Any Resolution

How and where do you implement the formula, if you don’t mind explaining?