|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#6
|
||||
|
||||
|
Re: Compiler Help Needed
Also, you can completley eliminate floating point from your code.
#define axelWidth 0.725 becomes: #define AXEL_WIDTH_NUM 29 #define AXEL_WIDTH_DEN 40 Constants that are #defined are usually all caps by convention. Also, keep in mind that when using integers, order of operations isn't the same as it is in your math class. Well, it is, but the order of operations will affect the result of the equation. Code:
// Consider: #define NUM 50 #define DEN 100 int foo = NUM / DEN * joy1_y int bar = NUM * joy1_y / DEN Basically, stick to integer math, and multiply to the biggest number you can before starting to divide using integers to prevent always multoplying by zero. Last edited by Jeff McCune : 07-02-2004 at 19:22. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C compiler for 2004 | Tim Skloss | Technical Discussion | 11 | 05-11-2003 22:02 |
| C compiler for 2004 | Tim Skloss | Robotics Education and Curriculum | 2 | 04-11-2003 16:19 |
| The Grand FIRST team.. programmers and others needed | randomperson | Programming | 0 | 31-05-2003 23:46 |
| Weight needed to tilt bridge... | archiver | 2001 | 4 | 23-06-2002 23:43 |
| Inventor 5.0 help needed | Larry Barello | Inventor | 4 | 27-01-2002 10:54 |