## How to use Math related function calls?

steve2077
Posts: 4
Joined: Mon Feb 02, 2015 3:20 pm

### How to use Math related function calls?

Hi there?

I would like to use some of math related function calls like pow, sin, sqrt...
But it seems math function doesn't work with SDK.
Either #include<math.h> on user_main or -lm on the Linker doesn't work too.
Do you have any idea to work them out?

Thanks

steve2077
Posts: 4
Joined: Mon Feb 02, 2015 3:20 pm

### Re: How to use Math related function calls?

I have solved some part of it by simulating the math function though, still I would like to know how to link standard math.h or math library in sdk(if available)..
Thanks..

Code: Select all

`double pow(double x,double y){ double z , p=1; //y<0 ? z=-y : z=y ; if(y<0)    z = fabs(y); else    z = y; for(int i=0; i<z ; ++i) {    p *= x; } if(y<0)   return 1/p; else   return p;}double fabs(double x){ return( x<0 ?  -x :  x );}`

neilwalker
Posts: 10
Joined: Wed Dec 20, 2017 7:17 pm

### Re: How to use Math related function calls?

Hello guys,
How do you use a functional math library? I've been just reading Programming Interviews Exposed: Secrets to Landing Your Next Job by John Mongan and Noah Kindler. I'm a programming intern from Rethymno studying online now in one of the American colleges.

https://writemyessaytoday.net
Erasmus student CV, Rethymno, Greece