CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Floating point trig

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
horkesley



Joined: 20 Feb 2007
Posts: 48
Location: Essex UK

View user's profile Send private message Send e-mail Visit poster's website

Floating point trig
PostPosted: Wed Mar 19, 2008 1:28 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Mar 19, 2008 1:37 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Mar 19, 2008 1:38 pm     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

Floating point trig
PostPosted: Wed Mar 19, 2008 3:58 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group