Problem Summary: Display Numbers
Pattern Key: NUMBER
Example:
Use When:
- Numbers are displayed,
- Exception: ID numbers (such as zip codes, phone numbers, part numbers, SSN, and the like) are left aligned, even when they are entirely numeric.
Solution:
- Numeric values are displayed in a fixed-width font and right aligned.
Note: Alignment should be with other values, not with the right edge of the panel. See Format of Currency for an example.
Exception: See exception for ID numbers under "Use When." - For numeric values where the number of places varies (e.g. quantities, which could be pounds, ounces, gallons, each, etc.) trailing zeros after the decimal place are removed. For example, 3.00 shirts is changed to 3 shirts.
Rationale: This may cause misalignment, but it is not that important because it will rarely happen and is not all that confusing. Nobody is going to be scanning the column or trying to add 3 shirts to 2.5 pounds of nails, so alignment is not all that important in this case. - Recommended: Avoid different numbers of decimal places in the same column, or align to the decimal point.
Rationale: Right aligned numbers are easier to read and compare.
Accessibility: See Accessibility
Internationalization: See Internationalization
Supporting Examples: None
Where Used: NA
Coding: NA
Items of Note: None
English language conventions with whole numbers?
Is there room in a standard like this to specify an english-language convention? Namely, if a number is going to be included in a sentence, it should be written out ("three") if it is in the range 1-9, otherwise as a number with no padding left or right.
It's been codified in the rules of grammar. Would be nice if it was repeated here. Many programmers are more familiar with the grammar of their favorite programming language than their native tongue.
-- Bruce