View Single Post
  #7   Spotlight this post!  
Unread 10-02-2004, 17:43
ShadowKnight's Avatar
ShadowKnight ShadowKnight is offline
Registered User
FRC #1719 (Umbrella Corporation)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2003
Location: Alexandria, VA
Posts: 142
ShadowKnight has a spectacular aura aboutShadowKnight has a spectacular aura about
Re: IFI loader help!

I had an inspiration today as I played with my calculator in math class. When I multiplied numbers too big, i got a message that said "Overflow," which is the same message I got from IFI loader. I have a sin function in my code which uses a MacLaurin series expansion to approximate sin. The code looks like this:

int sin(unsigned int theta)
{
if (theta > 9000) {return (-sin(theta - 18000));} /*maclaurin series for approximation, works only in radians*/

else {
float th = theta * 3.1415/ 18000;
return (int)(th - (th * th * th / 6) + (th * th * th * th * th / 120) * 100);
}
}/* end sin*/


so I think the pic couldn't raise an unsigned int to the fifth power, because the number got too large. I commented out the math and now it works.

Thanks!
__________________
Gracious Professionalism isn't simply courtesy or tradition, it's a way of life

I met her through FIRST...

We only are where we are by God's providence and by no other...