View Single Post
  #9   Spotlight this post!  
Unread 15-12-2006, 19:18
teh_pwnerer795 teh_pwnerer795 is offline
Registered User
AKA: !!Mitch!!
FRC #1392
Team Role: Programmer
 
Join Date: Nov 2006
Rookie Year: 2006
Location: Ajax, Canada
Posts: 142
teh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really nice
Send a message via MSN to teh_pwnerer795 Send a message via Yahoo to teh_pwnerer795
Re: Rounding numbers

Quote:
Originally Posted by neilsonster View Post
You should just follow his advice. If you do add a round function, remember to should add a declaration for the function to the header (.h) file [edit: or at the top of the .c file if you really want...] (sorry if this is obvious to you, but I'm not sure what kind of experience you have). I'm just curious.. why do you need to round? You should avoid using floating point numbers on a robot's processor, since it's easy to run out of memory on those things. Stick to integers if at all possible. Remember that you don't need pinpoint precision when running the robot.
Ye i noe wat u mean about the memory running out... For the auto mode i just want a delay for seconds.... my code is using floating numbers.. and i dont want that... i just want a insingle incrementing integer..

my code:

int i = 1;
static int time_i;

i=i+1; // This will increment 'i' by the value 1 every loop
time_i = ((i * 262) / 10000);

But thats going to caculate a floating number... i would just like a rounded integer from that sorta type of logic.... srry if i seem confusing....
__________________
Great Art is Created; Master Pieces are Stolen

[n00b]Teh_Foxdonut teh_pwnerer795 - CounterStrike:Source