Actions

icon Post
text/html Subscribe
text/html Unsubscribe

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

Re: [cxx-abi-dev] Request for clarification: floating point literal mangling


  • To: Zack Weinberg <zack@xxxxxxxxxxxxxxxx>
  • Subject: Re: [cxx-abi-dev] Request for clarification: floating point literal mangling
  • From: Jim Dehnert <dehnert@xxxxxxxxxxxxx>
  • Date: Sun, 08 Jun 2003 21:22:33 -0700

Zack Weinberg wrote:
The current text referring to the mangling of floating-point literals
in template parameters has a number of ambiguities.  Here's what it
says:

     Floating-point literals are encoded using a fixed-length lowercase
     hexadecimal string corresponding to the internal representation
     (IEEE on Itanium), high-order bytes first, without leading
     zeroes. For example: "Lf bf800000 E" is -1.0f on Itanium.

I see four problems:

1) It is not clear what "internal representation" means.  The example
   suggests that the intent is to use the bit pattern that the
   processor would store in memory, considered as an integer.
   However, it might also refer to the compiler's internal
   representation of floating point numbers, which may or may not be
   the same thing.

It was intended to mean the hardware memory representation.

2) "Fixed length" and "without leading zeroes" contradict each other.

3) Assuming that "without leading zeroes means, e.g. that the mangling
   of the denormalized single precision float 1.40129846e-45f is
   "Lf 1 E", it is not clear whether 0.0f should be mangled as
   "Lf 0 E" or "Lf E".

I don't know what the existing implementations have done, but I suspect
that this is a misstatement and that we meant without trailing zeroes,
which makes much more sense for FP.  But at this point, the confusion
should be resolved based on what the implementations do.

4) The example indicates that the "n" prefix is not used for negative
   floating point literals, but the text doesn't make that clear.

Right.

Jim

--
-	    Jim Dehnert		dehnert@xxxxxxxxxxxxx
	    (408)919-6984	dehnertj@xxxxxxx