bnclabs / gson

Algorithms on data formats - JSON, CBOR, Collation.
http://prataprc.github.io/jsonsort.io
MIT License
19 stars 8 forks source link

Binary collation: transparently handle int64, uint64 and float64. #9

Closed prataprc closed 7 years ago

prataprc commented 7 years ago

Values in int64, uint64 and float64 should be comparable as if they belong to the same type -Number. Like suggested elsewhere, sorting is a human perception.

Also while converting Binary-collate back to Value, or CBOR, or JSON make sure that precision and accuracy is not lost.

Finally, add test cases to validate them same.

prataprc commented 7 years ago

All of them - int64, uint64, float64 are handled as floating point, without loss of precision or accuracy (other than what float64 already suffers).