C語言實現pow()函式
阿新 • • 發佈:2020-12-25
電平補償增益需要計算 coef = 10^(db/20)。(gcc計算需要加-lm)
db的取值是[-1,1]
double pow(double dValue, double* dCoef )
{
double c = 0;
//c = pow(10,0.005);
dCoef = c = 1.011579;
printf("[IFQ_GetFreqCompen]c = %f\r\n", c );
int i = 0;
if( dValue == 0 )
{
dCoef = 1;
}
if( dValue > 0 )
{
dValue = dValue *10;
for(i =0 ; i <dValue ; i++)
{
dCoef = dCoef * c;
}
}
if( dValue < 0 )
{
dValue = dValue * ( -10 );
for(i =0 ; i <dValue ; i++)
{
dCoef = dCoef * c;
}
dCoef = 1/dCoef ;
}
}