how to implement floating point computing such as 'log'?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

hello, I am a custermor who use your product CYCKIT-050 development KIT. I want to do some floating point computing on such chip. I could run your demo project like ADC_DAC, LCD, etc...

   

However when I implement a program used y=log(x), the compiler showed error and fail to compile. I have already include "math.h" in my project:

   

#include <device.h>
#include <math.h>

   

void main()

   

{ float y,x;

   

y=log(x);

   

}

   

It compiled wrong in the PSoC Creator 2.1 enviroment! but when I write y=log(10); the compiling seemed ok. Such problem really confused me, please help me out!!

0 Likes
3 Replies
Anonymous
Not applicable

Try this:

   

Goto Project > Build Settings > Linker > General > Additional Libraries.

   

Now type m in the Additional Libraries field. 

   

You could also refer to this KB article: http://www.cypress.com/?id=4&rID=42838

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

@DPAK

   

Congratulations! Your first post and a quite correct, prompt and complete one!

   

 

   

Bob

0 Likes
Anonymous
Not applicable

This math library supports log10() function as well.

   

 

   

-

   

Kishore.

0 Likes