Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

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

cross mob
lock attach
Attachments are accessible only for community members.
AlVa_264671
Level 5
Level 5
25 sign-ins First like given First like received

Hi There !

I have some issues to implement  "double sqrt (double ) " in code.

My code include  math.h but the buildin give me the attached info.

Any suggestion?

Thanks

0 Likes
1 Solution
ADSW
Moderator
Moderator
Moderator
50 likes received 250 sign-ins 50 solutions authored

Hi @AlVa_264671 , 

Please adding "m" to additional library, 
I hope this KBA: Using Math Functions in PSoC® Creator™ for the PSoC 4 or PSoC 5LP GCC Compiler – KBA93076 can help you. 

warm regards
ADSW

View solution in original post

4 Replies
Arpit_S
Moderator
Moderator
Moderator
50 likes received 250 replies posted 100 solutions authored

Hi @AlVa_264671 ,

 

Let me implement the same at my end and share the project with you. I see you have tagged PSoC 5 in the thread, So I will implement the same with PSoC 5 device

 

Thanks!
Kind Regards

Arpit Srivastav

0 Likes
Arpit_S
Moderator
Moderator
Moderator
50 likes received 250 replies posted 100 solutions authored

Hi @AlVa_264671 ,

 

The error says cannot find Imath.h, I tried below mentioned code, I didn't get the build error. 

#include "project.h"
#include <math.h>
#include <stdio.h>

int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */

double x = 64;
double result;
result = sqrt(x);

/* Place your initialization/startup code here (e.g. MyInst_Start()) */

for(;;)
{
/* Place your application code here. */
}
}

 

Let me know if this helps

Kind Regards
Arpit Sirvastav

0 Likes
ADSW
Moderator
Moderator
Moderator
50 likes received 250 sign-ins 50 solutions authored

Hi @AlVa_264671 , 

Please adding "m" to additional library, 
I hope this KBA: Using Math Functions in PSoC® Creator™ for the PSoC 4 or PSoC 5LP GCC Compiler – KBA93076 can help you. 

warm regards
ADSW

ADSW
Thanks so much.
0 Likes