View previous topic :: View next topic |
Author |
Message |
horkesley
Joined: 20 Feb 2007 Posts: 48 Location: Essex UK
|
Floating point trig |
Posted: Wed Mar 19, 2008 1:28 pm |
|
|
Hi,
I need to be able to do the following x=sqrt(float); and other floating trig. functions.
I believe the CCS compiler can't do this, am I correct?
Regards, _________________ Horkesley Electronics Limited |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Mar 19, 2008 1:37 pm |
|
|
It's right there in math.h:
Code: | float32 sqrt(float32 x) |
Here's the file location:
Quote: | c:\program files\picc\drivers\math.h |
It's also in the CCS manual. Please download the manual.
http://www.ccsinfo.com/downloads/CReferenceManual.pdf |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Mar 19, 2008 1:38 pm |
|
|
CCS has all the standard trig functions including sqrt() and they work on floats. It is rare that I would use a float on a PIC regardless of whose compiler because they take so much RAM & ROM. But CCS supports float math as well as anyone.
What is your application? _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
horkesley
Joined: 20 Feb 2007 Posts: 48 Location: Essex UK
|
Floating point trig |
Posted: Wed Mar 19, 2008 3:58 pm |
|
|
Hi SherpaDoug, PCM programmer,
Thanks for the reply.
I received an error message 'only integers supported'.
I will investigate further.
SherpaDoug, my application relates to using radio to calculate the distance the receive is from several transmitters.
I then use trilateration to calculated the position of the receiver relataive to the transmitters.
I plan to achieve a position accuracy better than 1 metre.
I write a lot of code with VB.NET and 'C' for the AVR series of micro's.
But hope to use a PIC for this application.
Regards, _________________ Horkesley Electronics Limited |
|
|
|