Do not remove the last digit from float values (#5974)

Trailing zeros are already removed inside the function FloatToString,
that is called immediately before the lines deleted by this commit.
This commit is contained in:
Javier Serrano
2020-06-23 01:57:45 +02:00
committed by GitHub
parent 14baf45c90
commit 0ec7600c67

View File

@@ -3285,10 +3285,6 @@ bool FieldDef::Deserialize(Parser &parser, const reflection::Field *field) {
value.constant = NumToString(field->default_integer());
} else if (IsFloat(value.type.base_type)) {
value.constant = FloatToString(field->default_real(), 16);
size_t last_zero = value.constant.find_last_not_of('0');
if (last_zero != std::string::npos && last_zero != 0) {
value.constant.erase(last_zero, std::string::npos);
}
}
deprecated = field->deprecated();
required = field->required();