I am trying to populate a string with a double value using a
sprintf(S, "%f", val);
Width should include the decimal point.
%8.2 means 8 characters wide; 5 digits before the point and 2 after. One character is reserved for the point.
5 + 1 + 2 = 8