Thread: Robot Drifting
View Single Post
  #5   Spotlight this post!  
Unread 15-02-2004, 21:49
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Robot Drifting

Quote:
Originally Posted by Phil_Lutz
You Constant (#define) can be a floating point value.
but....
when you apply it in your program the result will be an int.
ie.

#define CONSTANT 1.5

int adjust_speed(int speed_in)
(
int speed_out;
speed_out = (speed_in/CONSTANT);
return speed_out; //sends back an int
)
however, the floating-point constant forces the processor to do floating point math, which is slower. in this case, using
Code:
#define CONSTANT 3/2
is better, because the processor can use integer math, which is faster.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)