wouldn't using "%.9f" suffice and force always showing a set number of digits?