本文介绍了如何在OCAML中获取Uint64的二进制表示形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有这个

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.

推荐答案

您似乎正在使用OPAM的uint模块.

It looks like you're using the uint module from OPAM.

uint模块具有一个名为Uint64.to_string_bin的函数,听起来像它可以完成您想要的操作.我目前尚未安装模块,因此无法尝试.

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.

这篇关于如何在OCAML中获取Uint64的二进制表示形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 20:56