I am working with big_int type. I looked in the OCaml’s library Pervasives.
For example: in Int32
let t = 5l
Printf.printf "%ld" t
How can I define t and which %?d if I want to declare it is an big_int?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Below is a toplevel session. The
#loaddirective would become a command-line link option if you used the compiler:For numbers that do not fit in a native
int, useBig_int.big_int_of_string. Example:Big_int.big_int_of_string "99999999999999999999999".The complete list of functions is here.
Finally, the
Big_intmodule is quite old and clumsy. The interface dates back to caml-light, in which the module system was rudimentary. This is the reason why each function name redundantly repeats “big_int…”. If you are choosing a big integer library now, I would recommend Zarith, which is modern and efficient. The drawback of Zarith is that it is a separate download (for now).