let i = 32
will give me a int32
.
What if I want to define a int64
?
let i = 32
will give me a int32
.
What if I want to define a int64
?
let i = 32L
(Postfix L for int64 literals introduced in Objective Caml 3.07)
and use module Int64: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Int64.html You should really use google as well...
let i = 32
will give you a value of type int
and not int32
.
You can obtain a int64
value by adding a L after the number as pointed out by piokuc and user1034081, But I am not sure that's what you want to do. Why do you want int64
?
OCaml has an internal representation for integers that is different from other languages and it store them on 31 or 63 bits (depending on your architecture) because it needs an extra bit for the GC. I you don't have a very good reason to use int64
(i.e. you want to use C code in OCaml or OCaml code in C), use the int
type.
You can specify the postfix 'L' for int64:
let i = 32L
leads to: val i : int64 = 32L