資源簡介
呵呵,比較有用哦,計(jì)算log10,
C代碼,管用。
代碼片段和文件信息
#include?
#include?
float?error=0.0;
?float?logx(float?x1)
??{
?????????float?x=x1*1.0;
?????????float?ylogx;
?????????int?i=1;
?????????int?n=0;
?????????int?k=1;?
?????????y=x;
????????if(x<=0)
????????{
???????????printf(“wrong!\n“);
???????????return?error;
????????}
???????while(x<1)
???????{
????????x*=10;
????????n--;?
???????}
?????while?(x>=10)
??????{
?????????x/=10;
????????n++;
?????
評論
共有 條評論