Clean up some numeric processing code
This commit is contained in:
@@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user