double strtof(const char *nptr)
{
const char *p;
int s, n, d;

s = 1;
n = 0;
d = 0;
for (p = nptr; *p != '\0'; p++)
if (*p == '+' || *p == '-') {
if (p != nptr)
break;
if (*p == '-')
s = -1;
} else
if (*p == '.')
d = 1;
else
if (*p >= '0' && *p <= '9') {
n = n * 10 + *p - '0';
d = d * 10;
} else
break;
if (d == 0)
d = 1;
return (double)s * (double)n / (double)d;
}