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
Current DAG-JSON cannot decode large negative integers as floats. If they are outside the i64 range, they get automatically converted into a float. This means that decoding a number like -11959030306112471732 becomes Float(-1.1959030306112471e19) instead of the expected Integer(-11959030306112471732).
One way is to indeed decode it as integer, another way (which is likely easier) is to have an error if it's outside the i64 range. I think such an error would be better then implicit conversion.
Though I should add that if someone spends time on the current DAG-JSON implementation, that it might be better spend on a new DAG-JSON implementation similar to https://github.com/ipld/serde_ipld_dagcbor.
This means that I'm not sure if this issue ever gets fixed in the current implementation. I just wanted to make sure this issue is tracked somewhere in case someone encounters it.
The text was updated successfully, but these errors were encountered:
Current DAG-JSON cannot decode large negative integers as floats. If they are outside the i64 range, they get automatically converted into a float. This means that decoding a number like -11959030306112471732 becomes
Float(-1.1959030306112471e19)
instead of the expectedInteger(-11959030306112471732)
.Here's an example test case:
One way is to indeed decode it as integer, another way (which is likely easier) is to have an error if it's outside the i64 range. I think such an error would be better then implicit conversion.
Though I should add that if someone spends time on the current DAG-JSON implementation, that it might be better spend on a new DAG-JSON implementation similar to https://github.com/ipld/serde_ipld_dagcbor.
This means that I'm not sure if this issue ever gets fixed in the current implementation. I just wanted to make sure this issue is tracked somewhere in case someone encounters it.
The text was updated successfully, but these errors were encountered: