Three possible Defect Reports from Fred Tydeman.
1) %.0a and rounding
Given FLT_RADIX is 2 and that
has these four possible outputs
Are the possible outputs of
0x2p+1 -- round up
0x1p+2 -- round up
0x1p+1 -- round down
In particular, are the three cases that round and drop bits allowed,
where there are alternate representations that do not lose any data?
This case of dropping bits has come up in real implementations. Some
always use less than 4 bits in the first hex digit output, while
others do that only if there is no rounding error.
3.9 correctly rounded result
220.127.116.11 The fprintf function
para 8 a,A along with footnote 236
I contend that correctly rounded requires the use of a representation
that minimizes the error between what is output and the value being
I believe footnote 236 should be changed to:
Binary implementations can choose the hexadecimal digit to the left of
the decimal-point character so that subsequent digits align to nibble
(4-bit) boundaries, as long as this representation has no more
rounding error than if the first hexadecimal digit were 8 or greater.
2) %a and trailing zeros
Given that FLT_RADIX is 2 and x is a double, what is the output of:
Some choices that occur to me are:
1) use the smallest precision for an exact representation of this
particular value; in effect, remove trailing zeros.
2) use the smallest precision for an exact representation of all
values of this type; in effect, keep trailing zeros.
3) use the smallest precision for an exact representation of all
values of all floating-point types; in effect, promote to long
double and keep trailing zeros.
4) implementation defined.
6) something else.
Some implementations that I have seen do 1, others do 2, and one does
both 1 and 2 (value and format dependent). I believe choice 1 is the
18.104.22.168 The fprintf function,
Paragraph 6 on the '#' flag has: "For g and G conversions, trailing
zeros are not removed from the result."
Paragraph 8, section a,A, has: "if the precision is missing and
FLT_RADIX is a power of 2, then the precision is sufficient for an
exact representation of the value;"
static char *filename = NULL;
static FILE *file = NULL;
filename = tmpnam(NULL);
file = fopen(filename,"wb");
Are these two equivalent:
file = freopen(filename, "wb", file);
file = freopen( NULL, "wb", file);
That is, do both succeed, or both fail for the same reason?
Some implementations succeed with the explicit filename, but fail with
the implicit filename; while others succeed for both. I believe that
these two are equivalent by the "as if" in 22.214.171.124.
126.96.36.199 The freopen function, paragraph 3 has: If filename is a null
pointer, the freopen function attempts to change the mode of the
stream to that specified by mode, as if the name of the file currently
associated with the stream had been used. It is implementation-defined
which changes of mode are permitted (if any), and under what
Does the "implementation-defined" apply to just the NULL case, or does
it apply to both cases (in which case, should it be its own