Reputation: 5118
I tried initializing an int64 variable in the following way :
let k:int64 = 4000000000;;
However I got the following error message :
Error: Integer literal exceeds the range of representable integers of type int
How do I intialise k to a value of 4 billion? Thanks.
Upvotes: 2
Views: 652
Reputation: 41290
You should use L
specifier to indicate an int64
literal:
let k = 4000000000L;;
Alternatively, since the number exceeds the range of int32, you can convert it from float
:
let k = Int64.of_float 4000000000.;;
Upvotes: 6