This is the mail archive of the gcc@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: testcase question (portability)


On Tue, Feb 24, 2004 at 07:06:20PM -0400, Aldy Hernandez wrote:
> Hi folks.
> 
> I'm thinking of adding this test, but I'm not sure it's 64-bit
> portable, sane across all architectures, etc.  BTW, this is the
> distilled testcase for the patch I just committed.
> 
> Cheers.
> Aldy
> 
> #define IM 2147483648u
>   int ival = 0x7ea4766d;
>   ival = (int) ((float) ival * 43.999F / (float) IM);

The result is between 

     4.353234863e+01      0x1.5c4240000p+5
     4.353234716e+01      0x1.5c423f3a8p+5

depending on float or double computation, so I think the 
test is probably portable.  But...

Do you actually need all that computation?  Does the test
still fail for 

	volatile float x = 4.353234863e+1 ;
	if ((int) x != 43)
	  abort ();

How in the world can SPE get this wrong?


r~


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