Attempting to make my module code Threadsafe

Not sure what the usage model is, but I feel like you should create a “Context” object that has the default precision, then all your methods would take this Context as a parameter.

My worry is, function A sets the default precision does some operations, calls function B which changes the default precision, does some operations, returns, function A continues to run but the default precision has changed. It would not be obvious looking at function A that the precision HAS changed.

It’s a recipe for hidden bugs, especially if the first pass of function B doesn’t change the default precision, but at some later point code is updated to change the default precision. If you don’t restore the precision when B exits, function A is going to operate differently.

This all assumes the default precision gets changed often, by your question it sounds like it does. The other option is you require the client set it once and it doesn’t get changed…