How to get a binary representation of Uint64 in OCAML

风流意气都作罢 提交于 2019-12-11 10:56:20

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!