about the problem of double primitive type

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: roger, 99jonathan, imaqine

about the problem of double primitive type

Postby ygxinqing » Mon Nov 26, 2012 9:24 am

Recently, I transplant lejos to the development board of mini2440. I use the cross compiler is arm-linux-gcc-4.3.2. I find a problem of double primitive type.
For example:
the Java program is:
long l = 900;
double d1 = 900.0;
double d2 = 0.900;
LCD.drawString( "l=" + l + "\n", 0, 0 );
LCD.drawString( "d1=" + d1 + "\n", 0, 0 );
LCD.drawString( "d2=" + d2 + "\n", 0, 0 );

the result is:
l=900
d1=000.0
d2=0.00000000000001E260

This matter is too strange! If I use the cross complier arm-linux-gcc-3.4.1, do not have this problem.
But my mini2440 development board can only use the arm-linux-gcc-4.3.2 cross complier :cry:

Who can tell me the reason? Thanks very much!
ygxinqing
New User
 
Posts: 5
Joined: Tue Jul 17, 2012 2:54 am

Re: about the problem of double primitive type

Postby gloomyandy » Mon Nov 26, 2012 9:55 pm

No real idea, possibly the way that doubles are stored in memory has been changed between the two versions? Seem to remember that the memory layout for doubles was a little odd. What results do you get if you change the code to be
double d2 = l1;
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3012
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: about the problem of double primitive type

Postby skoehler » Mon Nov 26, 2012 10:06 pm

We use gcc 4.3.2 to build the NXT firmware. And we don't have any problems with the float/double format. So I don't have any idea either.
skoehler
leJOS Team Member
 
Posts: 1128
Joined: Thu Oct 30, 2008 4:54 pm

Re: about the problem of double primitive type

Postby gloomyandy » Tue Nov 27, 2012 10:42 am

What Arm chip is used in the mini2440? Does it have any sort of fp unit?
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3012
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff