What happened?
static ValueExtractor<Float> floatValueExtractor() {
return ValidatingValueExtractor.<Float>builder()
.setExtractor(JsonNode::floatValue)
.setValidator(
jsonNode ->
jsonNode.isFloat()
// Either floating number which allows lossless conversion to float
|| (jsonNode.isFloatingPointNumber()
&& jsonNode.doubleValue() == (double) (float) jsonNode.doubleValue())
// Or an integer number which allows lossless conversion to float
|| (jsonNode.isIntegralNumber()
&& jsonNode.canConvertToInt()
&& jsonNode.asInt() == (int) (float) jsonNode.asInt()))
.build();
}
a double value is converted to float and then converted to double again, the result value is never not equal to its original value.
Issue Priority
Priority: 1 (data loss / total loss of function)
Issue Components
What happened?
a double value is converted to float and then converted to double again, the result value is never not equal to its original value.
Issue Priority
Priority: 1 (data loss / total loss of function)
Issue Components