问题
Suppose I have this
let var = Uint64.of_string "0x15E" ;;
How do I convert the above no. to get a binary string which would be
0b101011110
Are there any libraries that would assist in this ? Any help regarding this matter would be appreciated.
回答1:
It looks like you're using the uint module from OPAM.
The uint module has a function named Uint64.to_string_bin that sounds like it does what you want. I don't have the module installed at the moment, so I can't try it.
来源:https://stackoverflow.com/questions/32686156/how-to-get-a-binary-representation-of-uint64-in-ocaml