/* @(#)atof.c 2.1 SCCS id keyword */ /* C library - ascii to floating */ #include #include double atof(p) register char *p; { register c; double fl, flexp, exp5; double big = 72057594037927936.; /*2^56*/ double ldexp(); int nd; register eexp, exp, neg, negexp, bexp; neg = 1; while((c = *p++) == ' ') ; if (c == '-') neg = -1; else if (c=='+') ; else --p; exp = 0; fl = 0; nd = 0; while ((c = *p++), isdigit(c)) { if (fl>= 1; if (exp==0) break; exp5 *= exp5; } if (negexp<0) fl /= flexp; else fl *= flexp; fl = ldexp(fl, negexp*bexp); if (neg<0) fl = -fl; return(fl); }