Clean up some numeric processing code

This commit is contained in:
Jason Turner
2015-01-13 17:04:34 -07:00
parent 12533ce3e1
commit 7761ceb736

View File

@@ -431,21 +431,13 @@ namespace chaiscript
} }
} }
std::stringstream ss(t_val.substr(0, i));
if (float_) if (float_)
{ {
float f; return const_var(std::stof(t_val.substr(0,i)));
ss >> f;
return const_var(f);
} else if (long_) { } else if (long_) {
long double f; return const_var(std::stold(t_val.substr(0,i)));
ss >> f;
return const_var(f);
} else { } else {
double f; return const_var(std::stod(t_val.substr(0,i)));
ss >> f;
return const_var(f);
} }
} }