EncodeFloat encodes a float v into a byte slice which can be sorted lexicographically later. EncodeFloat guarantees that the encoded value is in ascending order for comparison.
(b []byte, v float64)
| 42 | // EncodeFloat encodes a float v into a byte slice which can be sorted lexicographically later. |
| 43 | // EncodeFloat guarantees that the encoded value is in ascending order for comparison. |
| 44 | func EncodeFloat(b []byte, v float64) []byte { |
| 45 | u := encodeFloatToCmpUint64(v) |
| 46 | return EncodeUint(b, u) |
| 47 | } |
| 48 | |
| 49 | // DecodeFloat decodes a float from a byte slice generated with EncodeFloat before. |
| 50 | func DecodeFloat(b []byte) ([]byte, float64, error) { |