Logarithm

More
7 years 11 months ago #120284 by yeepah
Logarithm was created by yeepah
Hy
I feel dumb
I try to install this code as compoment file .comp:

float thermistor2temperature(float R) {
float T;
if (R<=0)
R=0.001; // avoid log(0)
T = 1.0/ ( 1.0/T0 + (1.0/B) * log(R/R0) );
return T;

I do include #include <rtapi_math.h>

During compilation i get error : implicit declaration of function 'log'

What am I doing wrong???
thanks

Please Log in or Create an account to join the conversation.

More
7 years 11 months ago #120297 by Grotius
Replied by Grotius on topic Logarithm
@Yann,

#include <rtapi_math.h>
log(10);

Will work.

You have to check your formula.

Please Log in or Create an account to join the conversation.

More
7 years 11 months ago #120317 by yeepah
Replied by yeepah on topic Logarithm
Thanks for your answer
But still don't want corporate. log( anything) always return implicit declaration of fonction 'log'
It's really weird and i don't know in which direction to look to find a solution

Please Log in or Create an account to join the conversation.

More
7 years 11 months ago #120324 by rodw
Replied by rodw on topic Logarithm
What happens if you use doubles?
Code:
double thermistor2temperature(double R) { double T;

I suspect a type error

Please Log in or Create an account to join the conversation.

More
7 years 11 months ago #120325 by yeepah
Replied by yeepah on topic Logarithm
I thought that also. And I try it again.
I even try with with a log alone like
double R = log(133)
but it return alway the same error

I'm a bit lost
Do you have an idea were can i find a log code function. I could write it but my mathematique skill are a bit poor.

Please Log in or Create an account to join the conversation.

More
7 years 11 months ago #120327 by Hakan
Replied by Hakan on topic Logarithm
You can test with
Code:
#include <math.h>

Please Log in or Create an account to join the conversation.

Time to create page: 0.053 seconds
Powered by Kunena Forum