ESP8266 Developer Zone The Official ESP8266 Forum 2015-03-26T09:16:07+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=298 2015-03-26T09:16:07+08:00 2015-03-26T09:16:07+08:00 https://bbs.espressif.com:443/viewtopic.php?t=298&p=1146#p1146 <![CDATA[Re: How to use Math related function calls?]]> Thanks..

Code:

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 );
}

Statistics: Posted by steve2077 — Thu Mar 26, 2015 9:16 am


]]>
2015-03-25T00:00:16+08:00 2015-03-25T00:00:16+08:00 https://bbs.espressif.com:443/viewtopic.php?t=298&p=1137#p1137 <![CDATA[How to use Math related function calls?]]>
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

Statistics: Posted by steve2077 — Wed Mar 25, 2015 12:00 am


]]>