cpython/Python/strtod.c

23 lines
344 B
C
Raw Normal View History

1991-04-16 17:45:40 +09:00
/* This is not a proper strtod() implementation, but sufficient for Python.
Python won't detect floating point constant overflow, though. */
1991-12-31 21:15:19 +08:00
extern int errno;
1991-12-24 21:29:10 +08:00
extern int strlen();
1991-04-16 17:45:40 +09:00
extern double atof();
double
strtod(p, pp)
char *p;
char **pp;
{
1991-12-31 21:15:19 +08:00
double res;
1991-04-16 17:45:40 +09:00
if (pp)
1991-12-24 21:29:10 +08:00
*pp = p + strlen(p);
1991-12-31 21:15:19 +08:00
res = atof(p);
errno = 0;
return res;
1991-04-16 17:45:40 +09:00
}