How to use functions from math library in Keil uVision MDK ARM?

I want to use log() function (natural logarithm) in one of my calculation of Temperature using the Stein Hart Equation. Microcontroller used is STM32L476 .

#define getTempKelvin(R) (1/(THERM_A + (THERM_B*log(R)) + (THERM_C*log(R)*log(R)*log(R))))
TempKelvin = (float)getTempKelvin(ThermResistance);


This is how I calculate the temperature where ThermResistance is the Resistance of the Thermistor that is measured. The problem is that, I'm getting 0 as value in variable TempKelvin ,I have included math.h library and checked CIMSIS DSP in Run Time Environment of Keil. How to solve this issue? I'm able to open math.h in keil and C is the language used but shows log is undefined, when tried to go to the definition.

• Possibly integer arithmetic coming into play. Just try #define getTempKelvin(R) (1.0f/(THERM_A + (THERM_B*log(R)) + (THERM_C*log(R)*log(R)*log(R)))) to see if that makes a difference. I haven't verified your equation. – Roger Rowland Apr 19 '17 at 5:52
• You probably can't see the definition of log() because the source code it's not available, the math library being provided as a pre-compiled static library (.a/.lib) – m.Alin Apr 19 '17 at 8:59