Original Post
Is it possible to predict or count the number of significant decimal digits in a floating point number? For instance, if I were to output as a simple decimal number string, how would I count the number of digits before and after the radix point without actually counting and printing them? I'd like to count the number of decimal digits before actually parsing and outputting them. This would be useful for things like the %g fomat mark in a printf() format string, which decides whether %f or %e would be shorter, then outputs the shortest one, or deciding the exact size of a buffer to be written into before so that it can be preallocated. Simply not doing it is not an option.