View Issue Details

IDProjectCategoryView StatusLast Update
0001476Issue 8 draftsShell and Utilitiespublic2024-06-11 09:12
Reporterkre Assigned To 
PrioritynormalSeverityEditorialTypeError
Status ClosedResolutionAccepted As Marked 
Product VersionDraft 2 
NameRobert Elz
Organization
User Reference
SectionXCU 2.14 / printf
Page Number3086
Line Number104321
Final Accepted Text0001476:0005390
Summary0001476: Missing '+' character in the second example explanation
Descriptionprintf(1) contains an example

    printf "%d\n" 3 +3 -3 \'3 \"+3 "'-3"

which for the first two lines output, is stated to produce

    3 Numeric value of constant 3
    3 Numeric value of constant 3

The second of those should be

    3 Numeric value of constant +3

to match the command line given.
Desired ActionIn line 104321 on page 3086 (XCU 2.14, printf, EXAMPLES)
(in issue 8, draft 2) change:

Numeric value of constant 3


to:

Numeric value of constant +3



As an optional extra (not a bug) it might be worth adding one more
constant to the command line (or two) and showing the output from
it (or them) as well, where the added command line arg(s) would be
hex &/or octal representations (0x1C or 0254 or whatever you like).
Tagsissue8

Activities

geoffclare

2021-06-21 09:26

manager   bugnote:0005388

Last edited: 2021-06-21 09:27

Suggested changes...

After line 104302 on page 3085 (XCU 2.14, printf, EXAMPLES), add:
The command:
printf '%d\n' 10 010 0x10
produces:
10
8
16

If the implementation supports floating-point conversions, the command:
printf '%.2f\n' 10 010 0x10 10.1e2 010.1e2 0x10.1p2
produces:
10.00
10.00
16.00
1010.00
1010.00
64.25

In line 104321 on page 3086 (XCU 2.14, printf, EXAMPLES), change:
Numeric value of constant 3
to:
Numeric value of constant +3


geoffclare

2021-06-24 16:17

manager   bugnote:0005390

Last edited: 2021-06-24 16:26

After line 104302 on page 3085 (XCU 2.14, printf, EXAMPLES), add:
The command:
printf '%d\n' 10 010 0x10
produces:
<table>
<tr><th>Output Line</th><th>Explanation</th></tr>
<tr><td><tt>10</tt></td><td>Decimal representation of the numeric value of decimal integer constant 10</td></tr>
<tr><td><tt>8</tt></td><td>Decimal representation of the numeric value of octal integer constant 010</td></tr>
<tr><td><tt>16</tt></td><td>Decimal representation of the numeric value of hexadecimal integer constant 0x10</td></tr>
</table>

If the implementation supports floating-point conversions, the command:
LC_ALL=C printf '%.2f\n' 10 010 0x10 10.1e2 010.1e2 0x10.1p2
produces:
<table>
<tr><th>Output Line</th><th>Explanation</th></tr>
<tr><td><tt>10.00</tt></td><td>The string "10" interpreted as a decimal value, with 2 digits of precision.</td></tr>
<tr><td><tt>10.00</tt></td><td>The string "010" interpreted as a decimal (not octal) value, with 2 digits of precision.</td></tr>
<tr><td><tt>16.00</tt></td><td>The string "0x10" interpreted as a hexadecimal value, with 2 digits of precision.</td></tr>
<tr><td><tt>1010.00</tt></td><td>The string "10.1e2" interpreted as a decimal floating-point value, with 2 digits of precision.</td></tr>
<tr><td><tt>1010.00</tt></td><td>The string "010.1e2" interpreted as a decimal (not octal) floating-point value, with 2 digits of precision.</td></tr>
<tr><td><tt>64.25</tt></td><td>The string "0x10.1p2" interpreted as a hexadecimal floating-point value, with 2 digits of precision.</td></tr>
</table>

On page 3086 replace lines 104317-104325 with:
In a locale that uses a codeset based on ISO/IEC 646: 1991, the command:
printf "%d\n" 3 +3 -3 \'3 \"+3 "'-3"
produces:
<table>
<tr><th>Output Line</th><th>Explanation</th></tr>
<tr><td><tt>3</tt></td><td>Decimal representation of the numeric value 3</td></tr>
<tr><td><tt>3</tt></td><td>Decimal representation of the numeric value +3</td></tr>
<tr><td><tt>-3</tt></td><td>Decimal representation of the numeric value -3</td></tr>
<tr><td><tt>51</tt></td><td>Decimal representation of the numeric value of the character <tt>'3'</tt> in the ISO/IEC 646: 1991 standard codeset</td></tr>
<tr><td><tt>43</tt></td><td>Decimal representation of the numeric value of the character <tt>'+'</tt> in the ISO/IEC 646: 1991 standard codeset</td></tr>
<tr><td><tt>45</tt></td><td>Decimal representation of the numeric value of the character <tt>'-'</tt> in the ISO/IEC 646: 1991 standard codeset</td></tr>
</table>

In the paragraph at line 104326, move the second sentence ("Since the last two ...") to before the first sentence ("Note that in a locale ...").

Issue History

Date Modified Username Field Change
2021-05-19 12:21 kre New Issue
2021-05-19 12:21 kre Name => Robert Elz
2021-05-19 12:21 kre Section => XCU 2.14 / printf
2021-05-19 12:21 kre Page Number => 3086
2021-05-19 12:21 kre Line Number => 104321
2021-06-21 09:26 geoffclare Note Added: 0005388
2021-06-21 09:27 geoffclare Note Edited: 0005388
2021-06-24 16:17 geoffclare Note Added: 0005390
2021-06-24 16:18 geoffclare Final Accepted Text => 0001476:0005390
2021-06-24 16:18 geoffclare Status New => Resolved
2021-06-24 16:18 geoffclare Resolution Open => Accepted As Marked
2021-06-24 16:18 geoffclare Tag Attached: issue8
2021-06-24 16:26 geoffclare Note Edited: 0005390
2021-07-02 12:18 geoffclare Status Resolved => Applied
2024-06-11 09:12 agadmin Status Applied => Closed