Регистрация | Вход
static double atof2(char* s){ long double res = 0; int sign = 1, powflag = 0; unsigned long long pow = 1; if (*s == '-') { sign = -1; s++; } while (*s != 0) { if (*s >= '0' && *s <= '9') { res = res * 10 + (*s - '0'); if (powflag) pow *= 10; } else if (*s == '.') powflag = 1; ++s; } return sign * (res / pow);}
{ "12.345", 12.345, '\0', 0 }, { "12.345e19", 12.345e19, '\0', 0 }, { "-.1e+9", -.1e+9, '\0', 0 }, { ".125", .125, '\0', 0 }, { "1e20", 1e20, '\0', 0 }, { "0e-19", 0, '\0', 0 }, { "4\00012", 4.0, '\0', 0 }, { "5.9e-76", 5.9e-76, '\0', 0 }, { "0x1.4p+3", 10.0, '\0', 0 }, { "0xAp0", 10.0, '\0', 0 }, { "0x0Ap0", 10.0, '\0', 0 }, { "0x0A", 10.0, '\0', 0 }, { "0xA0", 160.0, '\0', 0 }, { "0x0.A0p8", 160.0, '\0', 0 }, { "0x0.50p9", 160.0, '\0', 0 }, { "0x0.28p10", 160.0, '\0', 0 }, { "0x0.14p11", 160.0, '\0', 0 }, { "0x0.0A0p12", 160.0, '\0', 0 }, { "0x0.050p13", 160.0, '\0', 0 }, { "0x0.028p14", 160.0, '\0', 0 }, { "0x0.014p15", 160.0, '\0', 0 }, { "0x00.00A0p16", 160.0, '\0', 0 }, { "0x00.0050p17", 160.0, '\0', 0 }, { "0x00.0028p18", 160.0, '\0', 0 }, { "0x00.0014p19", 160.0, '\0', 0 }, { "0x1p-1023", 1.11253692925360069154511635866620203210960799023116591527666e-308, '\0', 0 }, { "0x0.8p-1022", 1.11253692925360069154511635866620203210960799023116591527666e-308, '\0', 0 }, { "Inf", HUGE_VAL, '\0', 0 }, { "-Inf", -HUGE_VAL, '\0', 0 }, { "+InFiNiTy", HUGE_VAL, '\0', 0 }, { "0x80000Ap-23", 0x80000Ap-23, '\0', 0 }, { "1e-324", 0, '\0', ERANGE }, { "0x100000000000008p0", 0x1p56, '\0', 0 }, { "0x100000000000008.p0", 0x1p56, '\0', 0 }, { "0x100000000000008.00p0", 0x1p56, '\0', 0 }, { "0x10000000000000800p0", 0x1p64, '\0', 0 }, { "0x10000000000000801p0", 0x1.0000000000001p64, '\0', 0 }, { NULL, 0, '\0', 0 }