- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
double func_atof(char *p){
double integer = 0.0, div = 1.0 , fract = 0.0 , sign = 1.0;
if( *p == 45 ){sign = -1.0, *p++ ; }
while ( isdigit(*p) ) {
integer = ( *p++ ) + (10.0 * integer) - 48.0 ;
}
if(*p == 46 ){
(*p++ ) ;
while ( isdigit(*p) ) {
fract = ( *p++ ) + (10.0 * fract) - 48.0 ;
div *= 10;
}
}
return (integer + fract / div ) * sign ;
}
Antervis 24.04.2017 21:12 # +1
guest 24.04.2017 23:55 # +1