Rajeshwar
Rajeshwar

Reputation: 11651

How to get a binary representation of Uint64 in OCAML

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.

Upvotes: 2

Views: 659

Answers (1)

Jeffrey Scofield
Jeffrey Scofield

Reputation: 66793

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.

Upvotes: 4

Related Questions