This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


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

Re: [rfa(arm)/rfc] Eliminate HOST_{FLOAT,DOUBLE,...}_FORMAT


> To me, the comment doesn't make sense.  If sizeof (host long double) == 
>> size of (target long double) and information is still being lost then I 
>> think floatformat_* has a bug.
> 
> 
> You could lose information if the original value's bit pattern is not
> a valid FP number.  Does floatformat_to_doublest handle these
> situations 110% correctly?  I see at least one FIXME comment in the
> code there.


At present this loss happens randomly depending on the host / target 
combination.  I would prefer GDB to at least have slightly more 
consistent behavour.

The next step would be to ramp up sim/common/sim-fpu.[hc] and use that 
for all FP caculations.

--

Anyway, looking at the code, yes there are several nasty errors:

   unsigned long mant;

should be ULONGEST so that it fits a 64 bit mantisa and:

       dto += ldexp ((double) mant, exponent - mant_bits);

unfortunatly doesn't take a ``long double''.

   /* Note that if exponent indicates a NaN, we can't really do anything 
useful
      (not knowing if the host has NaN's, or how to build one).  So it will
      end up as an infinity or something close; that is OK.  */


sigh.

	Andrew





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