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
manual:chapter3:numformatting [2021/10/05 10:32]
jojo1973 Presets
manual:chapter3:numformatting [2021/10/05 15:29] (current)
jojo1973 [Format localization]
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 147: Line 147:
 ^ Position  ^ Character  ^ Function  ^ Notes  ^ ^ Position  ^ Character  ^ Function  ^ Notes  ^
 | **1**  | ''.''  | Decimal separator  | This is the character used to divide the integer part of a number from the fractional part. This character is **NOT** the same as the [[manual:chapter3:reals#approximate-versus-exact|approximation dot]] which is always displayed as a dot.  | | **1**  | ''.''  | Decimal separator  | This is the character used to divide the integer part of a number from the fractional part. This character is **NOT** the same as the [[manual:chapter3:reals#approximate-versus-exact|approximation dot]] which is always displayed as a dot.  |
-| **2**  | **U**+2009 (thin space)  Integer separator  | This is the character used to divide the digits groups in the integer part of a number. +| **2**  | **U**+2009\\ (thin space)  | Integer separator  | This is the character used to divide the digits groups in the integer part of a number. 
-| **3**  | **U**+2009 (thin space)  Fractional separator  | This is the character used to divide the digits groups in the fractional part of a number. +| **3**  | **U**+2009\\ (thin space)  | Fractional separator  | This is the character used to divide the digits groups in the fractional part of a 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.  |+| **4**  | '',''  | Arguments separator  | This is the character used to divide the arguments of a symbolic function (e.g. ''%%'%%GCD(16,32)%%'%%''or the real and imaginary parts of a complex number (e.g. ''(1,-2)'').  |
  
-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.
  
 ---- ----
  
 ==== Preset formats ==== ==== Preset formats ====
-**newRPL** provides a certain number of preset formats which can be quickly accessed via the keyboard:+A different, user friendly way to change the display of numbers is to use the preset formats that are provided by **newRPL**. These presets are quickly accessed via the keyboard and can be combined in many different ways:
  
   * **ON<sup>hold</sup>-SP** cycles thru number format presets;   * **ON<sup>hold</sup>-SP** cycles thru number format presets;
-  * **ON<sup>hold</sup>-DT** cycles thru localization presets; +  * **ON<sup>hold</sup>-DOT** cycles thru localization presets; 
-  * **ON<sup>hold</sup>-{1...9}** selects the length of the fractional part in scientific or engineering mode. +  * **ON<sup>hold</sup>-{1...9}** selects the length of the fractional part in scientific or engineering mode; 
-   +  * **ON<sup>hold</sup>-{MUL/DIV}** switches to engineering mode and selects ''Auto'' (no preferred exponent) or a preferred exponent in the range ''-21'' to ''21'' in steps by 3. 
-**__Number format presets__** +\\ \\  
-Name  ^ Small numbers format  ^ Small numbers cutoff  ^ Normal numbers format  ^ Large numbers cutoff  ^ Large numbers format  ^+**__Base number format presets__** 
 +Preset name  ^ Small numbers format  ^ Small numbers cutoff  ^ Normal numbers format  ^ Large numbers cutoff  ^ Large numbers format  ^
 | **STD**  | ''#.12#.E*''  | ''1E-12''  | ''#.12#.''  | ''1E+12''  | ''#.12#.E*''  | | **STD**  | ''#.12#.E*''  | ''1E-12''  | ''#.12#.''  | ''1E+12''  | ''#.12#.E*''  |
 +| **FIX**  | ''#.12#.E*''  | ''1E-12''  | ''#.12#0.''  | ''1E+12''  | ''#.12#.E*''  |
 +| **SCI**  | ''#.12#.E*''  | ''1E-12''  | ''#.12#.E''  | ''1E+12''  | ''#.12#.E*''  |
 +| **ENG**  | ''#.12#.E*''  | ''1E-12''  | ''#.12#.E*#''  | ''1E+12''  | ''#.12#.E*''  |
 +\\ \\ 
 +**__Base localization presets__**
 +^ Preset name  ^ Integer grouping  ^ Fractional grouping  ^ Decimal separator  ^ Integer separator  ^ Fractional separator  ^ Arguments separator  ^
 +| ''1000.000000'' | **No** | **No** | ''.'' | **U**+2009\\ (thin space) | **U**+2009\\ (thin space) | '','' |
 +| ''1,000.000000'' | **Yes** | **No** | ''.'' | '','' | **U**+2009\\ (thin space) | '';'' |
 +| ''1 000.000000'' | **Yes** | **No** | ''.'' | **U**+2009\\ (thin space) | **U**+2009\\ (thin space) | '','' |
 +| ''1000.000 000'' | **No** | **Yes** | ''.'' | **U**+2009\\ (thin space) | **U**+2009\\ (thin space) | '','' |
 +| ''1,000.000 000'' | **Yes** | **Yes** | ''.'' | '','' | **U**+2009\\ (thin space) | '';'' |
 +| ''1 000.000 000'' | **Yes** | **Yes** | ''.'' | **U**+2009\\ (thin space) | **U**+2009\\ (thin space) | '','' |
 +| ''1000,000000'' | **No** | **No** | '','' | **U**+2009\\ (thin space) | **U**+2009\\ (thin space) | '';'' |
 +| ''1.000,000000'' | **Yes** | **No** | '','' | ''.'' | **U**+2009\\ (thin space) | '';'' |
 +| ''1 000,000000'' | **Yes** | **No** | '','' | **U**+2009\\ (thin space) | **U**+2009\\ (thin space) | '';'' |
 +| ''1000,000 000'' | **No** | **Yes** | '','' | **U**+2009\\ (thin space) | **U**+2009\\ (thin space) | '';'' |
 +| ''1.000,000 000'' | **Yes** | **Yes** | '','' | ''.'' | **U**+2009\\ (thin space) | '';'' |
 +| ''1 000,000 000'' | **Yes** | **Yes** | '','' | **U**+2009\\ (thin space) | **U**+2009\\ (thin space) | '';'' |
  • manual/chapter3/numformatting.1633455161.txt.gz
  • Last modified: 2021/10/05 10:32
  • by jojo1973