Instructions
UM-0085-B09 DT80 Range User Manual Page 352
RG
The precision value means different things depending on the conversion type:
Type
precision term specifies:
Default
d, x, X, o (integer)
minimum number of digits to print (leading zeroes will be added if necessary) no minimum
e
,
E
,
f
(floating point)
number of digits to the right of decimal point
6 digits
g, G (mixed)
number of significant digits shown
6 digits
c
(single character)
not applicable
s (string)
maximum number of characters from the string to print
no maximum
Variable Width & Precision
The width and precision values are normally specified as numeric constants (e.g. %9.2f), but they can also be specified
as an asterisk (
*), in which case the value of a CV is used instead.
Output Action syntax and example
Description
%{flag}*.{precision}type[wCV,nCV]
e.g. %*d[1CV,4CV] or %-*.2f[1CV,3CV]
output the value of nCV in the specified numeric format, with the width
parameter set to the value of wCV
%{flag}*.*[wCV,pCV,nCV]
e.g. %*.*g[1CV,4CV,5CV]
as above, but also set the precision parameter to the value of pCV
Flag Character
Finally, the flag character allows some further options:
Flag
Applicable conversion types
Description
-
d, x, X, o, e, E, f, g, G, s
left justify (if spaces need to be added to make up the minimum field
width, add them after the number rather than before)
+
d, x, X, o, e, E, f, g, G
prefix value with
+
character, if it is positive
(space)
d, x, X, o, e, E, f, g, G
prefix value with space character, if it is positive
0 (zero)
d, x, X, o, e, E, f, g, G
pad the field with leading zero characters (rather than spaces) if
required to make up the minimum field width
#
x, X, o
prefix value with 0x, 0X or 0, respectively
#
e, E, f
always include a decimal point
#
g, G
do not truncate any trailing zeroes after the decimal point
Examples
Examples, assume 1CV=12345.67, 1$="pumpkin"
1SERIAL("{%f[1CV]}") → "12345.67"
1SERIAL("{%10f[1CV]}") → " 12345.67"
1SERIAL("{%10.1f[1CV]}") → " 12345.7"
1SERIAL("{%-10.1f[1CV]}") → "12345.7 "
1SERIAL("{%010.1f[1CV]}") → "00012345.7"
1SERIAL("{%10.10d[1CV]}") → "0000012345"
1SERIAL("{%10.4g[1CV]}") → " 1.235e04"
1SERIAL("{%#10.0f[1CV]}") → " 12346."
1SERIAL("{%s[1$]}") → "pumpkin"
1SERIAL("{%10s[1$]}") → " pumpkin"
1SERIAL("{%10.4s[1$]}") → " pump"