Numeric Format Dialog Box
- Updated2025-04-09
- 4 minute(s) read
Numeric Format Dialog Box
Click Edit Numeric Format in the Properties dialog box for a numeric array, variable, or property or select Numeric Format from the context menu for a local variable to launch the Numeric Format dialog box. You can also launch this dialog box from other locations. For example, click Edit Format on the Contents tab of the Report Options dialog box or on the General tab of the Properties dialog box.
Use this dialog box to specify the format TestStand uses to display the value of a numeric variable or property. Changes to the numeric format affect only the display value and do not affect the underlying numeric value of the variable or property. For example, a value of 5.11111 displays as 0x5 when you select hexadecimal as the format type, even though the underlying value is not a whole number. In addition, text searches you perform with the Find/Replace dialog box and the Find in Files dialog box compare using the formatted value instead of the decimal value.
The Numeric Format dialog box contains the following options:
- Sample —A sample number to which the dialog box applies the current format settings. You can enter different numbers to test the effects of the format settings.
- Formatted Number —Displays the effect of the format settings on the sample number.
- Type —The numeric format type. You can choose one of the following options from the ring control: Real, Integer, Unsigned Integer, Hexadecimal, Octal, Binary, or < Use Default >. When you select < Use Default >, the numeric variable or property does not specify a format and displays using the default TestStand format of %.17g unless you specify the format in another option, such as the Default Numeric Format control on the Contents tab of the Report Options dialog box.
- Number of Fractional Digits —The number of digits to display after the decimal point. This control is only visible when you set Type to Real and do not set Exponent to Automatic. If the value to format contains more fractional digits than this control specifies, the fractional portion of the formatted number rounds to the specified number of fractional digits. If the value to format contains fewer fractional digits than this control specifies, the Display Trailing Zeros control determines whether to append zeros to reach the specified number of fractional digits.
- Maximum Number of Significant Digits —The maximum number of significant digits to display. This control only appears when you set Type to Real and Exponent to Automatic.
- Minimum Number of Digits —The minimum number of digits to display. This control is only visible when you do not set Type to Real. If the value to format contains fewer digits than the minimum, this option prefixes the formatted number with leading zeros.
- Minimum Field Width —The minimum number of characters in the formatted number. If the number does not contain the minimum number of characters, TestStand appends spaces before or after the number according to the setting of the Align Left control.
- Sign —Indicates that a sign prefixes the formatted number. The following options are available in the ring control: Minus Sign Only, Plus or Minus Sign, or Space or Minus Sign.
-
Exponent
—Specifies whether the number appears in scientific notation. The following options are available in the ring control:
- No —Do not use scientific notation.
- Yes —Use scientific notation.
- Automatic —Use the most compact form of notation for the current value.
- Display Trailing Zeros —Appends zeros to the fractional portion of the formatted number if the value to format contains fewer fractional digits than the number the Number of Fractional Digits control specifies. This control applies only when you set Type to Real and the formatted number does not contain an exponent.
- Align Left —When you enable this option, the formatted number aligns to the left edge of the field. The alignment is applied before removing the trailing zeros.
- Fill Width with Leading Zeros —When you enable this option, TestStand fills the empty space before the number with zeros. This option applies only when you set Type to Real and disable the Align Left option.
- Always Show Decimal Point —When you enable this option, the formatted number includes a decimal point even when it does not have a fractional portion. This control applies only when you set Type to Real and the formatted number does not contain an exponent.
- Show Radix Prefix —Specifies whether a radix prefix precedes binary, octal, or hexadecimal numbers.
- Use Uppercase Letters —Specifies whether radix prefixes, exponent characters, and hexadecimal digits appear in uppercase.
- Format —The underlying format code the dialog box settings specify.
-
Custom
—Enables editing of the underlying format code in the Format control. TestStand supports standard numeric format specifiers. Use the following format:
%[Flags][Width][.Precision]<Type>
with the following valid values:
- Flags — -, +, $, 0, #, blank)
- Width —0 ... 15
- Precision —0 ... 15
- Type —d, i, u, x, X, o, O, b, B, e, E, f, g, G
Note The syntax of the numeric format string is identical to the format string that the C printf function accepts, with the following exceptions:- Place a $ character after the % character in the format string to remove trailing zeros after the decimal point.
- Use a format code of %b to format a number in binary.
- Specify an empty string to set the format to the default numeric format.
- Check Format —Checks the validity of any underlying format code you enter in the Format control. This control is only visible when you enable the Custom control.