You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 8, 2026. It is now read-only.
Numbers can be represented in different ways in CBOR. We should specify how they should be encoded so that all implementations will result with the same binary representation, hence the same hash.
For integers we can follow the Canonical CBOR as specified in the CBOR RFC and use the smallest possible representation.
For floats I'd also follow the recommendation from the Canonical CBOR and represent them as small as possible.
I would do it the js-ipfs way and use an integer if possible, which aligns well with the Converting from JSON to CBOR section of the CBOR RFC. I'm not sure if "without fractional parts" only mean numbers without a decimal point or also include numbers which have only zeros after the decimal point. I would store numbers with a decimal point and zeros only as integer.
Numbers can be represented in different ways in CBOR. We should specify how they should be encoded so that all implementations will result with the same binary representation, hence the same hash.
For integers we can follow the Canonical CBOR as specified in the CBOR RFC and use the smallest possible representation.
For floats I'd also follow the recommendation from the Canonical CBOR and represent them as small as possible.
Then there's the last case, floats without a fraction, which actually triggered this issue (see ipld/interface-ipld-format#9 (comment)).
I would do it the js-ipfs way and use an integer if possible, which aligns well with the Converting from JSON to CBOR section of the CBOR RFC. I'm not sure if "without fractional parts" only mean numbers without a decimal point or also include numbers which have only zeros after the decimal point. I would store numbers with a decimal point and zeros only as integer.