Go to Post Theory is when you know everything but nothing works. Practice is when everything works but you don't know why. On our team, theory and practice comes together. Nothing works and nobody knows why. - CalTran [more]
Home
Go Back   Chief Delphi > Technical > Programming
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 16-01-2005, 01:51
KVermilion's Avatar
KVermilion KVermilion is offline
... clearly ...
#0649
 
Join Date: Jan 2005
Location: Saratoga, Ca
Posts: 52
KVermilion is infamous around these parts
New math functions?

I've looked around in the new code and compiler docs and such and IO have yet to see any mention of new math libraries, or math libraries at all.

Any hints on where the math libraries are and any documentation?
  #2   Spotlight this post!  
Unread 16-01-2005, 02:13
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: New math functions?

They're in the /h folder of the new compiler. There's a very nice math.h file, as well as an stdio.h file. Now I don't have to use my Maclauren approximations for trig functions!
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_
  #3   Spotlight this post!  
Unread 16-01-2005, 18:17
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,633
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Re: New math functions?

Quote:
Originally Posted by jgannon
They're in the /h folder of the new compiler. There's a very nice math.h file, as well as an stdio.h file. Now I don't have to use my Maclauren approximations for trig functions!
What functions are they? Do they take Int16 inputs/outputs? It would make a lot of the calculations for autonomous navigation easier if we don't have to roll our own trig functions.

Joe J.
__________________
Joseph M. Johnson, Ph.D., P.E.
Mentor
Team #88, TJ2
  #4   Spotlight this post!  
Unread 17-01-2005, 01:39
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
Re: New math functions?

They are (straight from math.h):

float fabs (float x); (absolute value)
float ldexp (float x, int n); (computes x*2^n)
float exp (float f); (e^f)
float sqrt (float x);
float asin (float x);
float acos (float x);
float atan2 (float y, float x);
float atan (float x);
float sin (float x);
float cos (float x);
float tan (float x);
float sinh (float x);
float cosh (float x);
float tanh (float x);
float frexp (float x, int *pexp); (splits into the fractional part of a float, which is returned, and the exponent which is stored in the pointer)
float log10 (float x);
float log (float x);
float pow (float x, float y);
float ceil (float x);
float floor (float x);
float modf (float x, float *ipart); (performs the modulus function on x, returns the result and stores the fraction in the pointer. Look in the manual for more explanation)
float fmod (float x, float y); (the remainder for x%y)

float mchptoieee (unsigned long v); (converts the microchip version of 32-bit to ieee standard)
unsigned long ieeetomchp (float v); (mchptoieee in reverse)
-----------------------------------------------------------------------------------

Unfortunately, thay all take floating point inputs and return floats. Its not hard to typecast though. And I, myself, am glad to have a math.h library at my disposal rather than using my own functions, even if it is for 32-bit floats.

If you've already installed the compiler, the manual should be in c:\mcc18\docs\ (or whatever-your-install-directory-is\docs). It has plenty of documentation available. There are also many functions to access deeper features of the chip that took some tricky coding before.

-Tony K
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year
  #5   Spotlight this post!  
Unread 17-01-2005, 09:49
nehalita's Avatar
nehalita nehalita is offline
Robots are friends
AKA: tagger fanatic
FRC #1345 (Platinum Dragons); FRC# 97 (RoboRuminants)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Ft. Laud, FL
Posts: 870
nehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond repute
Send a message via AIM to nehalita Send a message via MSN to nehalita Send a message via Yahoo to nehalita
Question Re: New math functions?

Quote:
Originally Posted by Anthony Kesich
They are (straight from math.h):
float cos (float x);
float cosh (float x);
-Tony K
Quick question: I looked up the difference between cos and cosh and it says that cosh was the hyperbolic cosine. What is a hyperbolic cosine and when would it be helpful to use it? (wow i think I've ended every post I've done here with a confused face...)
__________________
"Relativity applies to physics, not ethics." Thank you Einstein
MIT '10

Proud Member of H.I.L.
The PLATINUM DRAGONS are on FIRE!

Last edited by nehalita : 17-01-2005 at 09:50. Reason: i mangled the post with spelling errors
  #6   Spotlight this post!  
Unread 17-01-2005, 09:53
Bharat Nain's Avatar
Bharat Nain Bharat Nain is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2003
Location: New York
Posts: 2,000
Bharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond repute
Send a message via AIM to Bharat Nain Send a message via MSN to Bharat Nain
Re: New math functions?

Quote:
Originally Posted by nehalita
Quick question: I looked up the difference between cos and cosh and it says that cosh was the hyperbolic cosine. What is a hyperbolic cosine and when would it be helpful to use it? (wow i think I've ended every post I've done here with a confused face...)
http://math.jccc.net:8180/webMathema...P/mmartin/cosh

http://www.omatrix.com/manual/cosh.htm

It involves some calc, see if you can figure it out with that link.
__________________
-= Bharat Nain =-

Whatever you do, you need courage. Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising that tempt you to believe your critics are right. To map out a course of action and follow it to an end requires some of the same courage that a soldier needs. Peace has its victories, but it takes brave men and women to win them. - Ralph Waldo Emerson

Last edited by Bharat Nain : 17-01-2005 at 09:54. Reason: Added another link
  #7   Spotlight this post!  
Unread 17-01-2005, 09:56
nehalita's Avatar
nehalita nehalita is offline
Robots are friends
AKA: tagger fanatic
FRC #1345 (Platinum Dragons); FRC# 97 (RoboRuminants)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Ft. Laud, FL
Posts: 870
nehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond repute
Send a message via AIM to nehalita Send a message via MSN to nehalita Send a message via Yahoo to nehalita
Re: New math functions?

Quote:
Originally Posted by Bharat Nain
http://math.jccc.net:8180/webMathema...P/mmartin/cosh

http://www.omatrix.com/manual/cosh.htm

It involves some calc, see if you can figure it out with that link.
"This page cannot be displayed"
__________________
"Relativity applies to physics, not ethics." Thank you Einstein
MIT '10

Proud Member of H.I.L.
The PLATINUM DRAGONS are on FIRE!
  #8   Spotlight this post!  
Unread 17-01-2005, 10:22
Pat Fairbank's Avatar
Pat Fairbank Pat Fairbank is offline
Circuit Breaker
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2001
Location: San Jose, CA
Posts: 2,131
Pat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond repute
Send a message via MSN to Pat Fairbank
Re: New math functions?

Quote:
Originally Posted by Joe Johnson
It would make a lot of the calculations for autonomous navigation easier if we don't have to roll our own trig functions.
For any team reluctant to use the floating-point trig functions in the provided math library (floating-point math is extremely slow because it's simulated by the compiler), there are some quicker integer-math trig libraries available, this being one of them.
__________________
Patrick Fairbank
Team 254 | Mentor (2012-)
Team 1503 | Mentor (2007-2011)
Team 296 | Alumnus (2001-2004) | Mentor (2005-2006)

patfairbank.com
  #9   Spotlight this post!  
Unread 17-01-2005, 10:38
ahecht's Avatar
ahecht ahecht is offline
'Luzer'
AKA: Zan
no team
Team Role: Alumni
 
Join Date: Dec 2001
Rookie Year: 2002
Location: Billerica, MA
Posts: 978
ahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond repute
Send a message via ICQ to ahecht Send a message via AIM to ahecht Send a message via Yahoo to ahecht
Re: New math functions?

Quote:
Originally Posted by nehalita
Quick question: I looked up the difference between cos and cosh and it says that cosh was the hyperbolic cosine. What is a hyperbolic cosine and when would it be helpful to use it? (wow i think I've ended every post I've done here with a confused face...)
The hyperbolic cosine cosh(x) = (e^x + e^-x)/2

It is very useful when evaluating certain integrals, but not really used outside of advanced calculus. A good description is here.
__________________
Zan Hecht

Scorekeeper: '05 Championship DaVinci Field/'10 WPI Regional
Co-Founder: WPI-EBOT Educational Robotics Program
Alumnus: WPI/Mass Academy Team #190
Alumnus (and founder): Oakwood Robotics Team #992


"Life is an odd numbered problem the answer isn't in the back of the book." — Anonymous WPI Student
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
Overloaded functions jgannon Programming 5 31-12-2004 11:04
White Paper Discuss: 296's CORDIC Math Library CD47-Bot Extra Discussion 5 28-04-2004 20:01
Do you write functions for your code? Max Lobovsky Programming 26 11-03-2004 07:04
Logical statements or math formulas Manoel Programming 1 16-02-2002 23:29


All times are GMT -5. The time now is 14:12.

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