Commit 44c201c4 authored by Guolin Ke's avatar Guolin Ke Committed by GitHub
Browse files

bug fixed in atof

parent 7d4b6d44
...@@ -148,6 +148,7 @@ inline static const char* Atof(const char* p, double* out) { ...@@ -148,6 +148,7 @@ inline static const char* Atof(const char* p, double* out) {
&& *(p + cnt) != ':') { && *(p + cnt) != ':') {
++cnt; ++cnt;
} }
if(cnt > 0){
std::string tmp_str(p, cnt); std::string tmp_str(p, cnt);
std::transform(tmp_str.begin(), tmp_str.end(), tmp_str.begin(), ::tolower); std::transform(tmp_str.begin(), tmp_str.end(), tmp_str.begin(), ::tolower);
if (tmp_str == std::string("na") || tmp_str == std::string("nan")) { if (tmp_str == std::string("na") || tmp_str == std::string("nan")) {
...@@ -160,6 +161,7 @@ inline static const char* Atof(const char* p, double* out) { ...@@ -160,6 +161,7 @@ inline static const char* Atof(const char* p, double* out) {
} }
p += cnt; p += cnt;
} }
}
while (*p == ' ') { while (*p == ' ') {
++p; ++p;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment