cpython/Python/strtod.c

23 lines
344 B
C
Raw Normal View History

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