Thread-safe access to real precision

+ Make precision a per-valuefactory setting, rather than global
Fix standard printing of single quote in strings

* Missing 'break' in switch would cause "\'" to be printed as "\'\\"
* Fix a few other minor things discovered by FindBugs
Fix: tan() would drop exception rather than throw it (FindBugs)