1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2 #include <msvcrt/stdlib.h>
3 #include <msvcrt/ctype.h>
4 //#include <msvcrt/unconst.h>
6 static double powten[] =
8 1e1L, 1e2L, 1e4L, 1e8L, 1e16L, 1e32L, 1e64L, 1e128L, 1e256L,
10 1e512L, 1e512L*1e512L, 1e2048L, 1e4096L
12 1e256L, 1e256L, 1e256L, 1e256L
17 _strtold(const char *s, char **sret)
19 double r; /* result */
20 int e, ne; /* exponent */
21 int sign; /* +- 1.0 */
31 while(*s && isspace(*s))
42 while ((*s >= '0') && (*s <= '9'))
53 while ((*s >= '0') && (*s <= '9'))
69 if ((*s == 'e') || (*s == 'E'))
79 while ((*s >= '0') && (*s <= '9'))
94 /* possibly subnormal number, 10^e would overflow */
112 d *= powten[l2powm1];