It's also not great advice to be so ridgid in this case... Having written numerical grading code, I learned the hard way that log10 based methods of counting SF is a very bad idea (fp errors occur toward but not at word precision limit) counting string length with some solid regex for extracting integer fraction and exponent parts on the other hand can handle any input precision.