Formatting Numbers
A picture is a textual representation of how a formatted number should look. The most basic picture simply describes the width of the formatted number using underscores to hold places. For example, to show that a number should have width eight, use a picture consisting of eight underscores. The underscores are numbered to show the width.
________
12345678
This will format the number 4.367, for example, as
4.367
To indicate where the decimal point should go, simply put the decimal point into the picture. A width eight number with two decimal places is specified with the following picture:
_____.__
12345678
(Note that the decimal point is included as one character in the width of the number format.) In this case, our number is formatted as
4.37
Rounding occurs automatically to make the number fit. Later, we'll show how you can set the rounding method.