the JSON encoding for floats states that rounding must be used for imprecisely declared values:
|
- A JSON number, that will be rounded to the nearest representable value. |
However, this rounding scheme ("round to the nearest representable value") doesn't define how ties should be handled, i.e. when there are 2 nearest representable values. Therefore this part of the spec is incomplete.
It seems that the IEEE 754 default rounding mode is "round ties to even", which picks the candidate value with the nearest even digit. I don't have access to the IEEE 754 spec but every resource I could find online seems to agree that this rounding mode is the default.
I propose adding a statement to the spec clarifying that ties should be handled according to the "round ties to even" rounding mode. In practice I don't think this change would affect implementations -- I assume everyone is already using the same default rounding mode. But it would make the interpretation of imprecise fill values completely specified, which would be helpful for other parts of the ecosystem that refer to the fill value encoding.
the JSON encoding for floats states that rounding must be used for imprecisely declared values:
zarr-specs/docs/v3/data-types/index.rst
Line 66 in dc3e95e
However, this rounding scheme ("round to the nearest representable value") doesn't define how ties should be handled, i.e. when there are 2 nearest representable values. Therefore this part of the spec is incomplete.
It seems that the IEEE 754 default rounding mode is "round ties to even", which picks the candidate value with the nearest even digit. I don't have access to the IEEE 754 spec but every resource I could find online seems to agree that this rounding mode is the default.
I propose adding a statement to the spec clarifying that ties should be handled according to the "round ties to even" rounding mode. In practice I don't think this change would affect implementations -- I assume everyone is already using the same default rounding mode. But it would make the interpretation of imprecise fill values completely specified, which would be helpful for other parts of the ecosystem that refer to the fill value encoding.