This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: testcase question (portability)
- From: Richard Henderson <rth at redhat dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 24 Feb 2004 16:59:44 -0800
- Subject: Re: testcase question (portability)
- References: <20040224230620.GA14209@redhat.com>
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~