Haven't figured out the extent of the problem yet, part or all of it may
be double alignment.

Here is (first) ARM output, then linux output.

pavilion: {1254} rsh ipaq /temp/f
Yow 16.000000 2.000000 -0.000000
a       00 00 00 00 00 00 30 40 00 00 00 00 00 00 00 00 
b       00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 
c       00 00 10 20 01 01 30 80 00 00 00 00 00 00 00 00 
Yow 0.000000 0.000000 0.000000 .. 0.000000
a       00 00 80 41 00 00 00 00 00 00 00 00 00 00 00 00 
b       00 00 80 40 00 00 00 00 00 00 00 00 00 00 00 00 
c       00 00 80 42 00 00 00 00 00 00 00 00 00 00 00 00 
d       00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
pavilion: {1255} ./f
Yow 16.000000 2.000000 32.000000
a       00 00 00 00 00 00 30 40 00 00 00 00 00 00 00 00 
b       00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 
c       00 00 00 00 00 00 40 40 00 00 00 00 00 00 00 00 
Yow 16.000000 4.000000 64.000000 .. 64.000000
a       00 00 80 41 00 00 00 00 00 00 00 00 00 00 00 00 
b       00 00 80 40 00 00 00 00 00 00 00 00 00 00 00 00 
c       00 00 80 42 00 00 00 00 00 00 00 00 00 00 00 00 
d       00 00 00 00 00 00 50 40 00 00 00 00 00 00 00 00 

Source is attached.

The first block of output handles double, the second one handles float.

I think this shows :
- the float multiplication works
  (same output as on x86/linux : 00 00 80 42)
- the double multiplication fails (different output)
- printing fails for float (but that's argument passing so it becomes
  double) but mysteriously not for doubles

Am I looking at the wrong thing ?
Ideas ?

        Danny

On Mon, 2009-05-25 at 11:08 +0200, Vincent R. wrote:
> On Fri, 22 May 2009 17:12:08 +0200, Danny Backx <danny.ba...@scarlet.be>
> wrote:
> > Floating point doesn't work. Does anyone know how this is supposed to ?
> > 
> >     Danny
> > 
> Hi,
> 
> How do you know it doesn't work ? What is your testcase ?
> 
> 
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals. Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, & 
> iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
> _______________________________________________
> Cegcc-devel mailing list
> Cegcc-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cegcc-devel
> 
-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define	SIZE	16

union f {
	unsigned char	bits[SIZE];
	double		d;
	float		f;
} a, b, c, d;

void doit(char *s, union f *p)
{
	int	i;

	printf("%s\t", s);
	for (i=0; i<SIZE; i++) {
		printf("%02X ", p->bits[i]);
	}
	printf("\n");
}

main()
{
	memset(&a, 0, sizeof(a));
	memset(&b, 0, sizeof(b));
	memset(&c, 0, sizeof(c));

#if 1
	a.d = 16;
	b.d = 2;
#else
	a.d = 234;
	b.d = 8;
#endif
	c.d = a.d * b.d;

	printf("Yow %f", a.d);
	printf(" %f", b.d);
	printf(" %f\n", c.d);

	doit("a", &a);
	doit("b", &b);
	doit("c", &c);

	memset(&a, 0, sizeof(a));
	memset(&b, 0, sizeof(b));
	memset(&c, 0, sizeof(c));
	memset(&d, 0, sizeof(d));

	a.f = 16;
	b.f = 4;
	c.f = a.f * b.f;
	d.d = c.f;

	printf("Yow %f", a.f);
	printf(" %f", b.f);
	printf(" %f", c.f);
	printf(" .. %f\n", d.d);

	doit("a", &a);
	doit("b", &b);
	doit("c", &c);
	doit("d", &d);

#if 0
	printf("Offset(f) : %d, size %d\n", (int)((void *)&a.f - (void *)&a), sizeof(a.f));
	printf("Offset(d) : %d, size %d\n", (int)((void *)&a.d - (void *)&a), sizeof(a.d));
#endif
	exit(0);
}
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to