Thread: Overflow?
View Single Post
  #1   Spotlight this post!  
Unread 16-02-2005, 01:31
Zalumaskov's Avatar
Zalumaskov Zalumaskov is offline
Premier
no team
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Place
Posts: 12
Zalumaskov is on a distinguished road
Overflow?

My robot's pos_x and pos_y variables seem to overflow over time but not because of incrementing...
If I don't move the robot the pos_x and pos_y stay 0 for a while then suddenly become 32767 (max int value?)

pos_x += sin(heading_radians) * dist;
pos_y += cos(heading_radians) * dist;


I'm using the float trig functions in math.h that comes with the new compiler. Is this happening because the float functions take too much time? Would Int Trig solve this?

thanks for your help!
__________________
I would change the world but I don't have the source code.