I\'m trying to work out why a larger problem is occurring, using a smaller program as an example. This smaller program does not work, leading me to believe it is my understa
I see two problems:
As others already said, you have to specify a double instead of an int. Your compiler may have a switch to print out warnings in these cases (-Wall in gcc, for example).
To print out 5.00..., you should use %f instead of %g.
That gives sprintf(word,"%.9f", (double) 5); as correct syntax.