[core] Handle NaN input to interpolate and step

This commit is contained in:
John Firebaugh
2018-01-10 11:48:06 -08:00
parent ecbb0baf60
commit cedda5ef4f
4 changed files with 20 additions and 12 deletions

View File

@@ -108,13 +108,9 @@ Value ValueConverter<float>::toExpressionValue(const float value) {
}
optional<float> ValueConverter<float>::fromExpressionValue(const Value& value) {
if (value.template is<double>()) {
double v = value.template get<double>();
if (v <= std::numeric_limits<float>::max()) {
return static_cast<float>(v);
}
}
return optional<float>();
return value.template is<double>()
? static_cast<float>(value.template get<double>())
: optional<float>();
}