Thread: ERROR
View Single Post
  #16   Spotlight this post!  
Unread 26-02-2005, 21:11
ace123's Avatar
ace123 ace123 is offline
Registered User
AKA: Patrick Horn
FRC #0008 (Paly Robotics - http://robotics.paly.net/)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Palo Alto, CA
Posts: 50
ace123 has a spectacular aura aboutace123 has a spectacular aura about
Send a message via AIM to ace123
Re: ERROR

First of all, I would HIGHLY recommend writing and using your own functions.

Are you using floating point powers (6^2.5) or only integers(6^3).

If you are using integer powers then it would be very easy to write your own function:
Code:
long powl(long y, int x) {
    long result=1;
    int i;
    for (i=0;i<x;++i) {
        result*=y;
    }
    return result;
}
(make sure to call a different name like powl instead of pow to avoid conflicts.)

That is much faster and better than using a function with floating point numbers (doubles), which are bad to use on these microprocessors and which one has little reason to use.

------------------------
Now, to answer your question about the hard way to do this:
The "old style" functions are when you do:
Code:
double pow(y,x)
double y, x;
{
    ...
}
The way to fix it is to change math.c:
Code:
double pow(double y,double x)
{
...
}
Do the same thing with ceil at line 71:
Code:
double ceil(double x)
{
...
}
__________________
-Patrick Horn, Paly Robotics

Check out the space simulator called Vega Strike, modelled after the space simulator games Elite and Wing Commander. It's Open Source too!
If you have ever played Wing Commander, or especially Privateer, and had a feeling of nostalga derived from the you will enjoy these two Vega Strike mods: Privateer Gemini Gold and Privateer Remake!
I'm working on adding multiplayer support this year...