Dik T. Winter said:
Sorry, I should have been more clear about the expected conditions
(hinted at a bit too indirectly by "etc"). My bad. See below.
Eh, no. It even can't hold 0.1 exactly. Remember, we are talking
floating-point here.
Actually, it could, for several different reasons.
(A) qfloat is a "floating point" type, but it is not one of the
three standard floating-point types. As such it's an extension
and isn't covered by the Standard. (Maybe someone else can find
a proviso for additional, implementation-defined floating-point
types, but I couldn't; even if the Standard allows such types,
qfloat doesn't have to be one of them). Since it's an extension
it isn't obligated to follow the model in 5.2.4.2.2.
(B) Even if qfloat does have to conform to the requirements of
other floating-point types, the model in 5.2.4.2.2 allows decimal
bases. Using a decimal base would allow exact representation of
decimal numbers.
(C) In fact, even the standard floating-point types don't have
to conform to the model given in 5.2.4.2.2. As noted in (16)
to 5.2.4.2.2 p 1:
(16) The floating-point model is intended to clarify
the description of each floating-point characteristic
and does not require the floating-point arithmetic of
the implementation to be identical.
As far as I can see (and I looked pretty thoroughly) there
is no requirement that floating-point types must conform
to the model given in 5.2.4.2.2. They do have to define
the macros, but other than that the choice of what numbers
can be represented and how they are represented is pretty
open.
Regardless of the precision, it is pretty difficult to get a guarantee
that for some precision the equation (a*a)/a==a does hold. But I think
you were thinking about integers where the original question was about
floating point.
The point of my original question was to discover whether
you were making a statement about the specific implementation
of qfloat or if you were meaning to make a more general
statement about how floating-point types might be implemented.
My question was indeed about floating-point and not about integers.
I think some confusion may have arisen because I was asking about
floating-point in the generality allowed by the Standard, whereas
you were commenting about floating-point as it is commonly (and in
fact, almost universally) implemented.
I responded to the a*a/a == a question in my last posting.