Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将浮点数转换为little-endian 格式的字节?
像
5.05 -> \x33\x33\x33\x33\x33\x33\x14\x40
像这样:
# let v = Int64.bits_of_float 5.05 in for i = 0 to 7 do Printf.printf "%Lx " (Int64.logand 255L (Int64.shift_right v (i*8))) ; done ;; 33 33 33 33 33 33 14 40 - : unit = ()