浏览代码

use stod in getDouble

Wolfgang Ortmann 9 年之前
父节点
当前提交
05575eb168
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/stringtools.cpp

+ 4 - 4
src/stringtools.cpp

@@ -126,15 +126,15 @@ long int getLongInt(const string& s, unsigned int& i)
 
 
 double getDouble(const string& s, unsigned int& i)
 double getDouble(const string& s, unsigned int& i)
 {
 {
-  if (!isdigit(s[i]) && s[i]!='-')
-    throw Exception("getDouble", "digit expected in " );
+  if (!isdigit(s[i]) && s[i] != '-')
+    throw Exception("getDouble", "digit expected in ");
   string is;
   string is;
-  while (i < s.size() && (isdigit(s[i]) || s[i]=='-' || s[i]=='.' || s[i]=='e' || s[i]=='E'))
+  while (i < s.size() && (isdigit(s[i]) || s[i] == '-' || s[i] == '.' || s[i] == 'e' || s[i] == 'E'))
     {
     {
       is += s[i];
       is += s[i];
       ++i;
       ++i;
     }
     }
-  double res = stof(is);
+  double res = stod(is);
   skipWS(s, i);
   skipWS(s, i);
   return res;
   return res;
 }
 }