manual:chapter3:numformatting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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 [Preset formats]
manual:chapter3:numformatting [2021/10/05 15:19]
jojo1973 [The format string]
Line 34: Line 34:
   "#.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>
Line 82: Line 82:
 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//.
Line 92: Line 92:
 | ''#.###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''  |
  
 ---- ----
Line 151: Line 151:
 | **4**  | '',''  | Arguments separator  | This is the character used to divide the arguments of a symbolic function or the real and imaginary parts of a complex number.  | | **4**  | '',''  | Arguments separator  | This is the character used to divide the arguments of a symbolic function or the real and imaginary parts of a complex number.  |
  
-The ''[[manual:chapter6:flags:cmd_getlocale|GETLOCALE]]'' returns on the stack the localization string.+The ''[[manual:chapter6:flags:cmd_getlocale|GETLOCALE]]'' command returns on the stack the localization string.
  
 ---- ----
  • manual/chapter3/numformatting.txt
  • Last modified: 2021/10/05 15:29
  • by jojo1973