char *ftoa(double f,char *buf) { int pos=0,ix,dp,num,width=8; if (f<0.0) { buf[pos++]='-'; f = -f; width--; } dp=0; while (f>=10.0) { f=f/10.0; dp++; } for (ix=1;ix =0;ix++) { num = f; f=f-num; if (num>9) buf[pos++]='#'; else buf[pos++]='0'+num; if (dp==0) buf[pos++]='.'; f=f*10.0; dp--; } buf[pos]='\0'; return buf; // return pos; }
セコメントをする