This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Support infinity, NaN, and denormalized numbers in floatformat.c


Carlo Wood <carlo@alinoe.com> writes:

> On Wed, Dec 03, 2003 at 01:12:45PM -0500, Ian Lance Taylor wrote:
> > Here is a patch to improve the support for infinity, NaN, and
> > denormalized numbers in floatformat.c.  It's not clear how to handle
> > these for non-IEEE formats.  But the old code did entirely the wrong
> > thing even when using IEEE formats, which are used by pretty much all
> > modern processors.  So I think we might as well do the right thing
> > here.
> 
> Sorry if this is not related - but what are you going to do
> with the demangling of floating point values?  I sensed a strong
> opposition against the IEEE decoding - so I removed my IEEE print
> routine again :/.
> 
> But if your demangler will demangle everything as IEEE regardless
> then I suppose I might as well do the same.

What I'm working toward right now is permitting the caller of the
demangling routines to pass in an optional array mapping floating
point types to floatformat structures.  Then if I see a floating point
literal, I can use the floatformat structures to pull it apart.  I
then plan to output the literal as a C99 hex floating point constant.
(A couple of people suggested this approach, and I can't think of a
good reason to not do it.)

If the demangler is called with no floatformat structures, then I plan
to just dump out the string without any attempt to display it as a
floating point number, just as I do today.

This approach probably doesn't help you, since you probably don't want
to deal with the floatformat routines.

Anyhow, I was setting up the floatformat array when I realized that
the floatformat routines were moderately bogus in that they completely
failed to handle denormalized numbers.  So I fixed them.

I do think this is all kind of ridiculous, since I'm sure that nobody
uses floating point constants in template expressions in real life.
And I think that changing the mangling of floating point constants
would be a much better solution for all concerned.  But I don't know
how to make that happen.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]