diff --git a/ccutil/scanutils.cpp b/ccutil/scanutils.cpp index cba7d549..fac50b2e 100644 --- a/ccutil/scanutils.cpp +++ b/ccutil/scanutils.cpp @@ -144,11 +144,11 @@ uintmax_t streamtoumax(FILE* s, int base) { } double streamtofloat(FILE* s) { - int minus = 0; - int v = 0; - int d, c = 0; - int k = 1; - int w = 0; + bool minus = false; + uint64_t v = 0; + int d, c; + uint64_t k = 1; + uint64_t w = 0; for (c = fgetc(s); isspace(static_cast(c)) && (c != EOF); @@ -169,8 +169,7 @@ double streamtofloat(FILE* s) { k *= 10; } } - double f = static_cast(v) - + static_cast(w) / static_cast(k); + double f = v + static_cast(w) / k; if (c == 'e' || c == 'E') { c = fgetc(s); int expsign = 1;