How to convert float to bytes in little-endian format in OCaml? -
how can convert float bytes in little-endian format?
like
5.05 -> \x33\x33\x33\x33\x33\x33\x14\x40
like this:
# let v = int64.bits_of_float 5.05 in = 0 7 printf.printf "%lx " (int64.logand 255l (int64.shift_right v (i*8))) ; done ;; 33 33 33 33 33 33 14 40 - : unit = ()