blob: e3fb81b921b2b89f718097f8db00d63681ba2912 [file] [log] [blame]
Guido van Rossum753e2bf1991-04-16 08:45:40 +00001/* This is not a proper strtod() implementation, but sufficient for Python.
2 Python won't detect floating point constant overflow, though. */
3
Guido van Rossum5afc7471991-12-31 13:15:19 +00004extern int errno;
5
Guido van Rossum54a41d61991-12-24 13:29:10 +00006extern int strlen();
Guido van Rossum753e2bf1991-04-16 08:45:40 +00007extern double atof();
8
Guido van Rossum753e2bf1991-04-16 08:45:40 +00009double
10strtod(p, pp)
11 char *p;
12 char **pp;
13{
Guido van Rossum5afc7471991-12-31 13:15:19 +000014 double res;
15
Guido van Rossum753e2bf1991-04-16 08:45:40 +000016 if (pp)
Guido van Rossum54a41d61991-12-24 13:29:10 +000017 *pp = p + strlen(p);
Guido van Rossum5afc7471991-12-31 13:15:19 +000018 res = atof(p);
19 errno = 0;
20 return res;
21
Guido van Rossum753e2bf1991-04-16 08:45:40 +000022}