lexico
Lexicographically orderable number encodings based on Sainath Mallidi's notes on "Storing data in order".
Example
i128
// => [128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 220, 224]
u128;
// => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 220, 224]
i8; // => [131]
i8; // => [0]
u8; // => [255]
i16; // => [127, 254]
i16; // => [128, 2]
u16; // => [255, 255]
i16; // => [0, 0]
i32; // => [128, 0, 0, 5]
u32; // => [0, 0, 0, 5]
i32; // => [127, 255, 255, 246]
i64;
// => [127, 255, 255, 255, 255, 255, 255, 255]
i64;
// => [128, 0, 0, 0, 0, 0, 0, 100]
i64;
// => [0, 14, 53, 250, 147, 26, 0, 0]
f32; // => [192, 134, 102, 102]
f32; // => [190, 215, 10, 61]
f32; // => [62, 224, 0, 0]
f32; // => [202, 0, 44, 128]
f32; // => [225, 54, 37, 94]
f32; // => [53, 255, 211, 128]
f64;
// => [62, 191, 250, 112, 0, 0, 0, 0]
f64;
// => [192, 106, 64, 0, 0, 0, 0, 0]
f64;
// => [192, 106, 64, 0, 0, 5, 94, 100]
License
This project is licensed under the terms of the MIT license.