In would appear that on Windows at least the Visual C Runtime MSVCRT doesn't offer control over the number of exponent digits that are output. Even my version of the same algorithm doesn't provide control over this at the moment. It is hard coded to be 3.
This is an extract from my version which produces the same output as Microsoft's but the code can actually be read and debugged. :-)
buffer[ 2 ] = ( exp % 10 ) + '0';
exp = exp / 10;
buffer[ 1 ] = ( exp % 10 ) + '0';
exp = exp / 10;
buffer[ 0 ] = ( exp % 10 ) + '0';
buffer += 3;
I'm afraid you're out of luck unless you want to code your own custom
fprintf
which I can tell you from experience is a lot of work.
[modified]
It would appear that I'm out of date and MS have improved there formatter implementation. See André's
Solution 2.
That's good because it was rubbish before but bad because now it's better than mine which means I have even more work to do.