This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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: problem with crosstool 0.28-pre28 supplied patch for gcc 3.3.[23] softfloat on ARM


On Tue, Aug 17, 2004 at 01:46:44AM +0200, Dimitry Andric wrote:

> > (You're also Dutch?)
> 
> Ja. :)

Such coincidence :)


> > I think it's applied correctly?  I'm trying this with hardfloat, if
> > I use fpa or vfp softfloat it does print the right number.
> 
> Hm, it sure still looks like glibc has swapped it around...

I'm not sure if it's glibc that's doing the swapping... see below.


> >         volatile float x;
> >         x = 1.0;
> >         printf("%f\n", x);
> 
> Right, maybe something goes wrong here when the float is promoted to
> double.  Can you try declaring x as double?

I just tried this:

<source>
#include <stdio.h>
#include <stdlib.h>

static void dumpdouble(volatile double *x)
{
        printf("%.8x %.8x %lf\n", ((unsigned int *)x)[0], ((unsigned int *)x)[1], *x);
}

int main()
{
        volatile double x, y, z;

        x = 1.0;   dumpdouble(&x);
        y = 1.0;   dumpdouble(&y);
        z = 2.0;   dumpdouble(&z);
        z = x + y; dumpdouble(&z);

        return 0;
}
</source>

And it gives me this:

<output>
3ff00000 00000000 1.000000
3ff00000 00000000 1.000000
40000000 00000000 2.000000
7fe00000 00000000 89884656743115795386465259539451236680898848947115328636715040578866337902750481566354238661203768010560056939935696678829394884407208311246423715319737062188883946712432742638151109800623047059726541476042502884419075341171231440736956555270413618581675255342293149119973622969239858152417678164812112068608.000000
</output>


cheers,
Lennert

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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