View unanswered posts | View active topics It is currently Fri Sep 19, 2014 9:56 am






Reply to topic  [ 5 posts ] 
a compiler bug. 
Author Message
Rookie

Joined: Thu Oct 25, 2012 10:16 am
Posts: 2
Post a compiler bug.
RobotC 3.51

v1 = -1.0 * sin(30.0/180.0*PI-90/180.0*PI)* 0 -(cos(30.0/180.0*PI-90/180.0*PI) * 0) + 0.135*90/180.0*PI;
v2 = -1.0 * sin(30.0/180.0*PI-90/180.0*PI)* 0 - cos(30.0/180.0*PI-90/180.0*PI) * 0 + 0.135*90/180.0*PI;

The two expressions above should get the same result, but it did not.

the result is :v1=0.212(correct) v2=-0.212(wrong)


Thu Oct 25, 2012 10:25 am
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: a compiler bug.
I don't have time to confirm it but it looks like it may be the same bug as:
viewtopic.php?f=63&t=4839
which is already fixed in the beta build.


Thu Oct 25, 2012 5:30 pm
Profile
Rookie

Joined: Thu Oct 25, 2012 10:16 am
Posts: 2
Post Re: a compiler bug.
MHTS wrote:
I don't have time to confirm it but it looks like it may be the same bug as:
viewtopic.php?f=63&t=4839
which is already fixed in the beta build.



Thank you for the response.

I think it's the same bug. Found in 3.50, but still exists in 3.51


Fri Oct 26, 2012 3:06 am
Profile
Expert

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 195
Post Re: a compiler bug.
I am running 3.5.4_1

Code:
 delta = degrees  * pi.ticksForFullPilotTurn / 360.0;
 printf("math %d * %d / 360 = %d", degrees, pi.ticksForFullPilotTurn, delta);


produces
math -91 * 522 / 360 = 50

should be -131ish.

edit; actually I can't get any math to work at the moment :(
Code:
 int temp = degrees * pi.ticksForFullPilotTurn;
 delta = temp / 360;


math -76 * 522 / 360 = 71 should be -110ish - it is beyond a paren / order of operations thing.

_________________
Mike aka Spiked3
http://www.spiked3.com


Fri Oct 26, 2012 2:34 pm
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 603
Post Re: a compiler bug.
This has been resolved for 3.54 - It was a matter of float/long calculations being truncated to 16 bits and causing really wacky numbers.

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Mon Nov 19, 2012 4:26 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.