This is the mail archive of the 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: [gfortran] PR15206 RRSPACING wrong for zero

On Friday 14 May 2004 15:13, Tobias Schlüter wrote:
> Paul Brook wrote:
> > On Saturday 08 May 2004 17:28, Tobias Schlüter wrote:
> >>This patch fixes the RRSPACING intrinsic. It didn't return the correct
> >>result for a zero argument. I don't really understand how the original
> >>code worked, but I verified that RRSPACING(x) == x/SPACING(x) for a wide
> >>range of arguments. I used the condition (expn == 0 && frac == 0) to
> >>check for a zero argument, if this is not the correct check, please
> >>correct this.
> >
> > I think frac==0 is a sufficient test. The result of clz(0) is undefined,
> > so we want to avoid that anyway
> I was afraid that frac == 0 for 1.0 as well, because the leading 1 is
> not recorded in FPNs. Of course, exp would be zero in that case as well.
> I'll try only checking frac == 0, and report back.

I'd forgotten about that. Looks like I don't understand this bit of code 
either :)
Go ahead and check in your original patch.

On a related issue, the existing rrspacing code to handle denormals is broken. 
This occurs when x < TINY(x), ie. expn == 0, frac != 0
I suspect the right shift should be a logical (unsigned) shift, not an 
arithmetic (signed) one. 


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