[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Proposed comments and changes to P754 draft (by Bob Davis)



(1) hexadecimal strings.

There is a good reason that the C99 syntax did not express the
exponent in hexadecimal:  the fact that, in that language,
floating-point literals may be qualified as to type, and the
qualifiers include letters that are also valid hexadecimal
digits (e.g. "f" for single-precision).

This brings back my main point: why this obsession with an actual
syntax specification for hexadecimal strings?  We don't have one
for decimal strings -- we have a specification for the substance
that is to be expressed.  So it should also be for clause 5.12.3,
namely a requirement for expressing binary floating-point values
in a way that does not require arithmetic conversion, and can
therefore clearly express the values exactly.

Now, what might have been appropriate is to select, among the many
possible character-string representations, some canonical forms that
must be supported is *some* way, not necessarily the most natural way
in any particular language.  This would be to enable communication
between different languages by means of "external" character strings.
It is not clear however that this is the business of P754 -- there
are other standards governing external data representations.

  It would also be proper to adjust the current hexExponent
  to be a decExponent as only decimal numbers are permitted.

Well, it is really a *binary* exponent, expressed in decimal or
in hexadecimal.  It would be nice to make that more explicit.

Back to the proposed syntax.  Can it be fixed?  Well, not in a
general way that would fit all languages, since there are many
kinds of token separation rules.  In fact, the 0x notation may
not fit in every language either; it may for example conflict
with pre-existing means of denoting hexadecimal literals.

So, instead of elaborating more on the specific hexadecimal syntax,
I would propose rewording the entire section to express the intent,
namely that there should be a way to specify binary floating-point
values exactly -- using for example hexadecimal notation.  (The
same effect could be achieved in a completely decimal way, simply
by providing the means to specify a binary exponent following an
integral significand.)

I'll address point (2), basic vs storage formats, later.

Michel.
Sent: 2007-11-06 17:13:46 UTC


754 | revision | FAQ | references | list archive