NumericFormats: Difference between revisions
added the ! character to the decimal point control |
Somehow all the recent changes to this article ended up on the "Glossary" page. Moved those changes here. |
||
| Line 5: | Line 5: | ||
'''Sign Control (Use only one max. per format, optional)''' | '''Sign Control (Use only one max. per format, optional)''' | ||
* absent: No "sign character" will use only the default, show. | * absent: No "sign character" will use only the default, show. | ||
* '''-''': Show '''-''' for negative and a '''space''' for positive values. | * '''-''': Show '''-''' for negative and a '''space''' for positive values. | ||
| Line 14: | Line 13: | ||
'''Digit Control''' | '''Digit Control''' | ||
* '''#''': A digit | * '''#''': A fixed digit that will be suppressed if it is a leading or trailing zero. | ||
* '''0''': A fixed digit that cannot be suppressed. Leading and trailing zeros will be output. | * '''0''': A fixed digit that cannot be suppressed. Leading and trailing zeros will be output. | ||
* '''b''': A fixed digit that will output a blank in place of each leading and trailing zero. | * '''b''': A fixed digit that will output a blank in place of each leading and trailing zero. | ||
| Line 20: | Line 19: | ||
'''Decimal Point Control''' | '''Decimal Point Control''' | ||
* absent: No decimal point control character implies an integer value. | * absent: No decimal point control character implies an integer value. | ||
* '''.''': Show the decimal point | * '''.''': Show the decimal point if there is a format character after the '''.'''. | ||
* '''^''': Do not show the decimal point. | * '''^''': Do not show the decimal point. | ||
* '''!''': | * ''',''': Show the decimal point only if the number has a fractional value. | ||
* '''!''': Show the decimal point always even if the value is a whole number. | |||
Note: For integer formats (ones with out any format characters after the decimal character), the decimal character will be ignored during output. | |||
'''Zero Control (optional)''' | '''Zero Control (optional)''' | ||
* ''';''': You may add a ''';''' to the end of a format. The text following the ''';''' will be output for any value equal to zero. If omitted, default zero will be from the actual format, which may reduce to nothing in the case of ### | * ''';''': You may add a ''';''' to the end of a format. The text following the ''';''' will be output for any value equal to zero. If omitted, default zero will be from the actual format, which may reduce to nothing in the case of ###.###. | ||
'''Rounding Control (optional)''' | '''Rounding Control (optional)''' | ||
* ''':''': This character my be added, followed with a 1, 2, or 5. This is the value that the last digit in the format will be rounded to. If omitted, a 1 is assumed. | * ''':''': This character my be added, followed with a 1, 2, or 5. This is the value that the last digit in the format will be rounded to. If omitted, a 1 is assumed. Some Examples are: {2.34531} | ||
Some Examples are: { | |||
::{| style="background-color:#eeeeee;" cellpadding="3" cellspacing="0" border="1" | ::{| style="background-color:#eeeeee;" cellpadding="3" cellspacing="0" border="1" | ||
{{Table Row|#.####|pretty standard for modern controls { | {{Table Row|###.####|pretty standard for modern controls {2.3453} }} | ||
{{Table Row|# | {{Table Row|###.####|pretty standard for modern controls {2.3453} }} | ||
{{Table Row|#.####;0|force zero to `0' { | {{Table Row|###.####;0|force zero to `0.' {2.3453} }} | ||
{{Table Row|2#.####| multiply times 2 { | {{Table Row|2##.####| multiply times 2 {4.6906} }} | ||
{{Table Row|#.####;0.:5|round to nearest .0005 { | {{Table Row|###.####;0.:5|round to nearest .0005 {2.3455} }} | ||
{{Table Row|*#.####;0.:2|times minus one {- | {{Table Row|*###.####;0.:2|times minus one {-2.3454} }} | ||
{{Table Row|+*#.####;0.:5|absolute value, then times minus one (always negative) {- | {{Table Row|+*###.####;0.:5|absolute value, then times minus one (always negative) {-2.3455} }} | ||
{{Table Row|3+*#.###| | {{Table Row|+*##.###|show + and - signs and force negative {-2.345} }} | ||
{{Table Row|00##.##0 |stupid, `#'s have effect only when on the outside | {{Table Row|3+*##.###|above times 3 {-7.036} }} | ||
{{Table Row|0000.000|same effect as above { | {{Table Row|00##.##0 |stupid, `#'s have effect only when on the outside {0002.345} }} | ||
{{Table Row|#00.0000#|{ | {{Table Row|0000.000|same effect as above {0002.345} }} | ||
{{Table Row|##00^0000#|stupid, formats without a visible decimal point may not have suppressible characters(`#') on both sides of the decimal and outside. The control has no way to figure out the real value. { | {{Table Row|##00.0000#|{02.34531} }} | ||
{{Table Row|#^###0|standard fixed format,leading zero suppression, 1 equals | {{Table Row|##00^0000#|stupid, formats without a visible decimal point may not have suppressible characters(`#') on both sides of the decimal and outside. The control has no way to figure out the real value. {0234531} }} | ||
{{Table Row|### | {{Table Row|###^###0|standard fixed format,leading zero suppression,1 equals .0001 {23453} }} | ||
{{Table Row| | {{Table Row|0##^####|standard fixed format,trailing zero suppression, 1 equals 100.0000 {0023453} }} | ||
{{Table Row|#|integer { | {{Table Row|###|integer {2} }} | ||
{{Table Row|###.|integer {2}. note that the decimal point is ignored. }} | |||
|} | |} | ||
| Line 62: | Line 62: | ||
When using Number commands, especially in lathe, use Radius Number commands and format them times two. We will probably eliminate the Diameter Number commands at some point in the future. | When using Number commands, especially in lathe, use Radius Number commands and format them times two. We will probably eliminate the Diameter Number commands at some point in the future. | ||
Revision as of 21:19, 18 October 2018
Numeric Formats
Multiplier (one per format, optional)
- 1 through 9 appearing in the format string before the first : or ;. The value will be multiplied by the single digit integer multiplier first, before any other formatting is performed. If omitted, a 1 is assumed.
Sign Control (Use only one max. per format, optional)
- absent: No "sign character" will use only the default, show.
- -: Show - for negative and a space for positive values.
Polarity Modification (use none, one or both in the same format, optional)
- *: Multiply value times minus one. This is always executed second by ncPost, regardless of order in format string.
- +: Show absolute value. This is always positive and always executed first by ncPost.
Digit Control
- #: A fixed digit that will be suppressed if it is a leading or trailing zero.
- 0: A fixed digit that cannot be suppressed. Leading and trailing zeros will be output.
- b: A fixed digit that will output a blank in place of each leading and trailing zero.
Decimal Point Control
- absent: No decimal point control character implies an integer value.
- .: Show the decimal point if there is a format character after the ..
- ^: Do not show the decimal point.
- ,: Show the decimal point only if the number has a fractional value.
- !: Show the decimal point always even if the value is a whole number.
Note: For integer formats (ones with out any format characters after the decimal character), the decimal character will be ignored during output.
Zero Control (optional)
- ;: You may add a ; to the end of a format. The text following the ; will be output for any value equal to zero. If omitted, default zero will be from the actual format, which may reduce to nothing in the case of ###.###.
Rounding Control (optional)
- :: This character my be added, followed with a 1, 2, or 5. This is the value that the last digit in the format will be rounded to. If omitted, a 1 is assumed. Some Examples are: {2.34531}
###.#### pretty standard for modern controls {2.3453} ###.#### pretty standard for modern controls {2.3453} ###.####;0 force zero to `0.' {2.3453} 2##.#### multiply times 2 {4.6906} ###.####;0.:5 round to nearest .0005 {2.3455} *###.####;0.:2 times minus one {-2.3454} +*###.####;0.:5 absolute value, then times minus one (always negative) {-2.3455} +*##.### show + and - signs and force negative {-2.345} 3+*##.### above times 3 {-7.036} 00##.##0 stupid, `#'s have effect only when on the outside {0002.345} 0000.000 same effect as above {0002.345} ##00.0000# {02.34531} ##00^0000# stupid, formats without a visible decimal point may not have suppressible characters(`#') on both sides of the decimal and outside. The control has no way to figure out the real value. {0234531} ###^###0 standard fixed format,leading zero suppression,1 equals .0001 {23453} 0##^#### standard fixed format,trailing zero suppression, 1 equals 100.0000 {0023453} ### integer {2} ###. integer {2}. note that the decimal point is ignored.
To use the new b correctly, it should be inside any # and outside any 0.
##b0.00b# {+b2.3453, the b represents a space}.
The standard convention is to list Multiplier first. Sign control second, Polarity modifiers third, followed by Digits and Decimal point control characters. Then comes special Zero control and Round control last. Following this simple convention will make it easier on everyone.
When using Number commands, especially in lathe, use Radius Number commands and format them times two. We will probably eliminate the Diameter Number commands at some point in the future.