Make the int/double option type detection slightly less broken

Choosing between int and double based on whether the default value is an
int is dumb and broken enough, but with the "ceil" the detection didn't
even work for negative numbers.

Originally committed to SVN as r5937.
This commit is contained in:
Thomas Goyne 2011-11-29 23:18:34 +00:00
parent b993c02dee
commit dfc68a4db9

View file

@ -105,7 +105,7 @@ void ConfigVisitor::Visit(const json::Array& array) {
void ConfigVisitor::Visit(const json::Number& number) {
if (int64_t(number) == ceil(number)) {
if (int64_t(number) == number) {
AddOptionValue(new OptionValueInt(name, int64_t(number)));
} else {
AddOptionValue(new OptionValueDouble(name, number));