There is a variable in my code that I don't how to name. As its value increases, the precision (of some calculations) decreases. I feel like it would be misleading if I called it "precision" but I can't think of the opposite. For a moment I thought about granularity but I am not sure if that is better.
Perhaps looseness would serve your purpose?
M-W offers one of the following definitions for the adjective loose:
6 a : lacking in precision, exactness, or care * loose brushwork * loose usage
and also provides an associated noun:
— looseness noun
This word has the advantage of being the same part of speech as precision, so it can be dropped right in as a substitute without requiring that your sentence be rewritten. So, for example, you could say:
As the measurement's precision increases, its looseness decreases.
As the measurement's looseness increases, its precision decreases.
The precision of this component's manufacture is very high.
The looseness of our current quality control procedure is unacceptable.
What about tolerance? High tolerance can mean low precision for measuring devices as explained in this link: