Using sqrt() function in Codewarrior 6.2

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using sqrt() function in Codewarrior 6.2

Jump to solution
3,077 Views
jreyes085
Contributor I

Hello,

 

Im trying to use this function but it doesnt works...i put this in the header of the file that i want to use the function:

 

#include "math.h"       /* include math functions */

 

What i want to do is this....

 

irms=sqrt(sum2corriente/NUM_MCICLO);

 

//they are defined like (copy&paste from my main.c):

//#define NUM_MCICLO  100

//

//#pragma DATA_SEG DEFAULT

//static  dword sum2corriente=0;

//static  dword irms=0;

 

How could i do this? i know that sqrt(double variable), is this going to work? i want it to tried but i compile the file and it gives no errro, but when i pressed the debug button then it shows this error:

 

Error #1> Link error: Undefined: "sqrt"
              Referenced from "TPM1_ISR" in main.c
Error #2> Link Failed.

 

Im using the irms calc in a Interruption subroutine....

 

Please help! how can i get this to work?

 

Thanks!

Labels (1)
0 Kudos
1 Solution
1,082 Views
stanish
NXP Employee
NXP Employee

Seems the floating point library (e.g. ansif.lib) is not included in your project. I'd suggest you to see this thread

 

Attached is the list of libraries available in CodeWarrior for MCUs v6.2.

 

Stanish

View solution in original post

0 Kudos
2 Replies
1,083 Views
stanish
NXP Employee
NXP Employee

Seems the floating point library (e.g. ansif.lib) is not included in your project. I'd suggest you to see this thread

 

Attached is the list of libraries available in CodeWarrior for MCUs v6.2.

 

Stanish

0 Kudos
1,082 Views
jreyes085
Contributor I

Thanks man! Gracias!

 

it works, i only create a new project and activate the floating point support...and it works!

 

Thanks, i was thinking of implement an asm algorithm to do the sqrt() function...

 

Thanks again!

0 Kudos