There are certain values that are managed independent of any specific code-accessible object. The decimal precision is a good example:
We can call these context variables. As your code shows, the true "home" of the "prec" value is not some object you manage in your code, but rather some background object called the Context.
The Context is not inherited by sub-threads.
Your code is fine, because you did not use threads. Replace the map with concurrent.futures code (as in my example).
Your code will not work properly anymore. This is the issue.