Both sides previous revision
Previous revision
Next revision
|
Previous revision
Last revision
Both sides next revision
|
manual:chapter3:numformatting [2021/10/05 11:47] jojo1973 [Format localization] |
manual:chapter3:numformatting [2021/10/05 15:19] jojo1973 [The format string] |
"#.12#." @ Normal | "#.12#." @ Normal |
1E-12 "#.12#.E*" @ Small numbers (< 1E-12) | 1E-12 "#.12#.E*" @ Small numbers (< 1E-12) |
1E+12 "#.12#.E*" @ Large numbers (> 1E+12) | 1E12 "#.12#.E*" @ Large numbers (> 1E+12) |
} | } |
</code> | </code> |
Various other options are available to format the fractional part of the number: | Various other options are available to format the fractional part of the number: |
| |
* when the number of decimal digits is expressed by a repetition of ''#'''s, replacing the last ''#'' with a ''0'' will append trailing zeros as needed to display the requested number of decimal figures. The ''0'' character counts as one additional digit. | * when the number of decimal digits is expressed by a repetition of ''#'''s, replacing the last ''#'' with a ''0'' will append as many trailing zeros as needed to display the requested number of decimal figures. The ''0'' character counts as one additional digit. |
* when the number of decimal digits is expressed by a number //d// followed by a ''#'', a trailing ''0'' still indicates that trailing zeros need to be added **but** in this case the presence of ''0'' does not add another digit. | * when the number of decimal digits is expressed by a number //d// followed by a ''#'', a trailing ''0'' still indicates that trailing zeros need to be added **but** in this case the presence of ''0'' does not add another digit. |
* the uppercase ''S'' following the last ''#'' or ''0'' indicates the presence of a separator. By default the separator is spaced every 3 digits, but that can be controlled by including the number of digits in each group immediately following the ''S''; for example ''"S4"'' will add the fractional separator every 4 digits. Valid values for ''S'' are ''1'' through ''15'', and the separator character used will be as defined by the command ''[[manual:chapter6:flags:cmd_setlocale|SETLOCALE]]''.\\ **NOTE**: the number of digits in a group must match between the integer and fractional part of the number, it's an invalid format string to request separators every //n// digits on the integer part, and //m// digits on the fractional part when //m≠n//. | * the uppercase ''S'' following the last ''#'' or ''0'' indicates the presence of a separator. By default the separator is spaced every 3 digits, but that can be controlled by including the number of digits in each group immediately following the ''S''; for example ''"S4"'' will add the fractional separator every 4 digits. Valid values for ''S'' are ''1'' through ''15'', and the separator character used will be as defined by the command ''[[manual:chapter6:flags:cmd_setlocale|SETLOCALE]]''.\\ **NOTE**: the number of digits in a group must match between the integer and fractional part of the number, it's an invalid format string to request separators every //n// digits on the integer part, and //m// digits on the fractional part when //m≠n//. |
| ''#.###0'' | 123.45 | ''123.4500'' | | | ''#.###0'' | 123.45 | ''123.4500'' | |
| ''#.4#0'' | 123.45 | ''123.4500'' | | | ''#.4#0'' | 123.45 | ''123.4500'' | |
| ''#.8#0S4'' | 123.45. | ''123.4500 0000.'' | | | ''#.8#0S4'' | 123.45 | ''123.4500 0000'' | |
| |
---- | ---- |