Go to Post A 823543:1 reduction should be fine if you ever need to pick up a truck...or a house. - Tim Sharp [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 19-01-2007, 21:50
Turdmoe Turdmoe is offline
Registered User
no team
 
Join Date: Jan 2007
Location: 1 AU from Sol
Posts: 3
Turdmoe is an unknown quantity at this point
linking error

I got a "linking error" when I compiled my code:
".code_sqrt.o' can not fit in the section. Section ' code_sqrt.o' length=0x00000442"
what does this mean?
  #2   Spotlight this post!  
Unread 19-01-2007, 22:17
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,835
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: linking error

It looks like your floating point calculations have completely filled your processors memory.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #3   Spotlight this post!  
Unread 27-01-2007, 19:01
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: linking error

If you are only using the sqrt function, you might like to see the implementation of InvSqrt():
http://www.beyond3d.com/articles/fastinvsqrt/

here is an implementation that I compiled on my first controller (the scary constant is a standard IEEE754 floating point number, so it will work on every microprocessor the same way).

I would definitely extensively test this method before putting it to use (i.e. don't hook up motors until you are sure it gives the expected answers), but I believe that it is just a first-order Newton's method approximation, with the constant being a first guess I believe.

I'm pretty sure it will take up less space than the included math library.

Code:
float invSqrt(float magnitudeSquared) {
    float xhalf;
    float temp;
    long i;
    
    // magic follows:
    temp = magnitudeSquared;
    xhalf = 0.5f*temp;
    i = *(long*)&temp;
    i = 0x5f3759df - (i>>1);
    temp = *(float*)&i;
    temp = temp*(1.5f - xhalf*temp*temp);
    
    // temp now contains the 1/sqrt(magnitudeSquared)
    return temp;
}
Definitely works on the computer:
Code:
5629.000:     InvSqrt 0.013318; 1/sqrt 0.013329
281.0000:     InvSqrt 0.059639; 1/sqrt 0.059655
28.00000:     InvSqrt 0.188722; 1/sqrt 0.188982
6.000000:     InvSqrt 0.407681; 1/sqrt 0.408248
4.000000:     InvSqrt 0.499154; 1/sqrt 0.500000
2.017857:     InvSqrt 0.703756; 1/sqrt 0.703971
0.250000:     InvSqrt 1.996614; 1/sqrt 2.000000
0.166667:     InvSqrt 2.445322; 1/sqrt 2.449490
0.000000:     InvSqrt 19817753709685768192; 1/sqrt inf
__________________
-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...
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Linking for '05 RC Jon236 Programming 2 12-02-2006 14:30
stupid Array error: Error [1300] stack frame too l Validius Programming 7 27-01-2006 10:53
A linking problem T Shap Programming 6 15-01-2006 00:23
weird sites linking to robotics teams robot180 Website Design/Showcase 7 16-05-2005 17:18
Dynamic Linking with PHP plutonium83 Website Design/Showcase 6 12-01-2005 19:41


All times are GMT -5. The time now is 00:08.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi