The only effective way to do this is using symbols, making sure that the symbols are *NEVER* converted to numeric values.
Once you're in the numeric domain, anything along the line of what you're trying to do will be squashed on by the laws of IEEE 754. If you insist on trying, go read the IEEE 754 documentation. At which point you will come back and beg to do it all with symbols.-)
The output of an external outputs accuracy in terms of "1. == accurate, everything below is less accurate" so I wanted to create a failsafe that kickstarts the patcher into the next phase in case the accuracy of the result is insufficient.
I could just multiply the output of the external by 1'000'000 I guess. I'll give it a shot that way, since I don't really care whether it operates with floats or integers. Should've think of that before. Still, seems "unclean"... :)
Here's an alternate way of doing it, using math instead of string formatting. This will give you the precision to n decimal places, but only if it's needed. It won't zero pad, but if that's okay, then game on; I think that's much easier to read, especially since the extra zeros aren't providing you with useful information.
You can also display arbitrary precision with live.number, btw. Check out the units/unit format in the attached code.
Arithmetic approaches rely on the assumption that floating-point multiplication and division is carried out in decimal. It's not; floating-point on computers is in binary (which is why I pointed people to IEEE 754, apparently an exercise in futility).
Both of the last two patches will give unexpected results (in other words, break) for the right (or, depending on your point of view, wrong) input values. I found a combination of values that broke Liubo's patch in about one minute (on another machine right now, sorry, otherwise I would upload a confirmatory screen shot). I daresay there are values out there for which Peter's patch will break.
To paraphrase John von Neuman: anyone attempting to round decimal values using binary arithmetic is, of course, in a state of sin.
At this stage, feeling more like the Magician's Nephew than The Doctor.
I'm aware of the precision issues, just had a feeling that this post had more to do with appearance than with some really high level of precision... (OP was truncating, after all)
If you care about decimal places and want to do it via math, do integer math (or if that's too small, do in some other language such as Java with BigDecimal or Long--though in that case, the regexp stuff is not so bad IF you do it inside js/mxj. It's a pain in Max because Max is always going to strip off leading zeros, etc.).