1Int64(3)                         OCaml library                        Int64(3)
2
3
4

NAME

6       Int64 - 64-bit integers.
7

Module

9       Module   Int64
10

Documentation

12       Module Int64
13        : sig end
14
15
16       64-bit integers.
17
18       This  module provides operations on the type int64 of signed 64-bit in‐
19       tegers.  Unlike the built-in int type, the type int64 is guaranteed  to
20       be  exactly  64-bit  wide  on all platforms.  All arithmetic operations
21       over int64 are taken modulo 2^64
22
23       Performance notice: values of type int64 occupy more memory space  than
24       values  of  type int , and arithmetic operations on int64 are generally
25       slower than those on int .  Use int64 only  when  the  application  re‐
26       quires exact 64-bit arithmetic.
27
28       Literals for 64-bit integers are suffixed by L:
29             let zero: int64 = 0L
30             let one: int64 = 1L
31             let m_one: int64 = -1L
32
33
34
35
36
37
38
39       val zero : int64
40
41       The 64-bit integer 0.
42
43
44
45       val one : int64
46
47       The 64-bit integer 1.
48
49
50
51       val minus_one : int64
52
53       The 64-bit integer -1.
54
55
56
57       val neg : int64 -> int64
58
59       Unary negation.
60
61
62
63       val add : int64 -> int64 -> int64
64
65       Addition.
66
67
68
69       val sub : int64 -> int64 -> int64
70
71       Subtraction.
72
73
74
75       val mul : int64 -> int64 -> int64
76
77       Multiplication.
78
79
80
81       val div : int64 -> int64 -> int64
82
83       Integer division.
84
85
86       Raises  Division_by_zero if the second argument is zero.  This division
87       rounds the real quotient of its arguments towards  zero,  as  specified
88       for (/) .
89
90
91
92       val unsigned_div : int64 -> int64 -> int64
93
94       Same as Int64.div , except that arguments and result are interpreted as
95       unsigned 64-bit integers.
96
97
98       Since 4.08.0
99
100
101
102       val rem : int64 -> int64 -> int64
103
104       Integer remainder.  If y is not zero, the result of Int64.rem x y  sat‐
105       isfies the following property: x = Int64.add (Int64.mul (Int64.div x y)
106       y) (Int64.rem x y) .  If y = 0 , Int64.rem x y raises  Division_by_zero
107       .
108
109
110
111       val unsigned_rem : int64 -> int64 -> int64
112
113       Same as Int64.rem , except that arguments and result are interpreted as
114       unsigned 64-bit integers.
115
116
117       Since 4.08.0
118
119
120
121       val succ : int64 -> int64
122
123       Successor.  Int64.succ x is Int64.add x Int64.one .
124
125
126
127       val pred : int64 -> int64
128
129       Predecessor.  Int64.pred x is Int64.sub x Int64.one .
130
131
132
133       val abs : int64 -> int64
134
135       Return the absolute value of its argument.
136
137
138
139       val max_int : int64
140
141       The greatest representable 64-bit integer, 2^63 - 1.
142
143
144
145       val min_int : int64
146
147       The smallest representable 64-bit integer, -2^63.
148
149
150
151       val logand : int64 -> int64 -> int64
152
153       Bitwise logical and.
154
155
156
157       val logor : int64 -> int64 -> int64
158
159       Bitwise logical or.
160
161
162
163       val logxor : int64 -> int64 -> int64
164
165       Bitwise logical exclusive or.
166
167
168
169       val lognot : int64 -> int64
170
171       Bitwise logical negation.
172
173
174
175       val shift_left : int64 -> int -> int64
176
177
178       Int64.shift_left x y shifts x to the left by y bits.  The result is un‐
179       specified if y < 0 or y >= 64 .
180
181
182
183       val shift_right : int64 -> int -> int64
184
185
186       Int64.shift_right  x  y  shifts  x  to the right by y bits.  This is an
187       arithmetic shift: the sign bit of x is replicated and inserted  in  the
188       vacated bits.  The result is unspecified if y < 0 or y >= 64 .
189
190
191
192       val shift_right_logical : int64 -> int -> int64
193
194
195       Int64.shift_right_logical x y shifts x to the right by y bits.  This is
196       a logical shift: zeroes are inserted in the vacated bits regardless  of
197       the sign of x .  The result is unspecified if y < 0 or y >= 64 .
198
199
200
201       val of_int : int -> int64
202
203       Convert  the  given integer (type int ) to a 64-bit integer (type int64
204       ).
205
206
207
208       val to_int : int64 -> int
209
210       Convert the given 64-bit integer (type int64 ) to an integer (type  int
211       ).   On 64-bit platforms, the 64-bit integer is taken modulo 2^63, i.e.
212       the high-order bit is lost during the conversion.  On 32-bit platforms,
213       the  64-bit integer is taken modulo 2^31, i.e. the top 33 bits are lost
214       during the conversion.
215
216
217
218       val unsigned_to_int : int64 -> int option
219
220       Same as Int64.to_int , but interprets the argument as an unsigned inte‐
221       ger.   Returns  None  if  the unsigned value of the argument cannot fit
222       into an int .
223
224
225       Since 4.08.0
226
227
228
229       val of_float : float -> int64
230
231       Convert the given floating-point number to a 64-bit integer, discarding
232       the  fractional  part  (truncate  towards  0).  If the truncated float‐
233       ing-point number is outside the range [ Int64.min_int  ,  Int64.max_int
234       ], no exception is raised, and an unspecified, platform-dependent inte‐
235       ger is returned.
236
237
238
239       val to_float : int64 -> float
240
241       Convert the given 64-bit integer to a floating-point number.
242
243
244
245       val of_int32 : int32 -> int64
246
247       Convert the given 32-bit integer (type int32  )  to  a  64-bit  integer
248       (type int64 ).
249
250
251
252       val to_int32 : int64 -> int32
253
254       Convert  the  given  64-bit  integer  (type int64 ) to a 32-bit integer
255       (type int32 ). The 64-bit integer is taken modulo 2^32, i.e. the top 32
256       bits are lost during the conversion.
257
258
259
260       val of_nativeint : nativeint -> int64
261
262       Convert  the given native integer (type nativeint ) to a 64-bit integer
263       (type int64 ).
264
265
266
267       val to_nativeint : int64 -> nativeint
268
269       Convert the given 64-bit integer (type int64 ) to a native integer.  On
270       32-bit  platforms,  the 64-bit integer is taken modulo 2^32.  On 64-bit
271       platforms, the conversion is exact.
272
273
274
275       val of_string : string -> int64
276
277       Convert the given string to a 64-bit integer.  The string  is  read  in
278       decimal  (by default, or if the string begins with 0u ) or in hexadeci‐
279       mal, octal or binary if the string begins with 0x , 0o  or  0b  respec‐
280       tively.
281
282       The  0u  prefix reads the input as an unsigned integer in the range [0,
283       2*Int64.max_int+1] .  If the input exceeds  Int64.max_int  it  is  con‐
284       verted  to the signed integer Int64.min_int + input - Int64.max_int - 1
285       .
286
287       The _ (underscore) character can appear anywhere in the string  and  is
288       ignored.
289
290
291       Raises  Failure if the given string is not a valid representation of an
292       integer, or if the integer represented exceeds the  range  of  integers
293       representable in type int64 .
294
295
296
297       val of_string_opt : string -> int64 option
298
299       Same as of_string , but return None instead of raising.
300
301
302       Since 4.05
303
304
305
306       val to_string : int64 -> string
307
308       Return the string representation of its argument, in decimal.
309
310
311
312       val bits_of_float : float -> int64
313
314       Return  the internal representation of the given float according to the
315       IEEE 754 floating-point 'double format' bit layout.  Bit 63 of the  re‐
316       sult represents the sign of the float; bits 62 to 52 represent the (bi‐
317       ased) exponent; bits 51 to 0 represent the mantissa.
318
319
320
321       val float_of_bits : int64 -> float
322
323       Return the floating-point number whose internal representation, accord‐
324       ing  to  the IEEE 754 floating-point 'double format' bit layout, is the
325       given int64 .
326
327
328       type t = int64
329
330
331       An alias for the type of 64-bit integers.
332
333
334
335       val compare : t -> t -> int
336
337       The comparison function for 64-bit integers, with the  same  specifica‐
338       tion as compare .  Along with the type t , this function compare allows
339       the module Int64 to be passed as argument to the functors Set.Make  and
340       Map.Make .
341
342
343
344       val unsigned_compare : t -> t -> int
345
346       Same  as  Int64.compare  , except that arguments are interpreted as un‐
347       signed 64-bit integers.
348
349
350       Since 4.08.0
351
352
353
354       val equal : t -> t -> bool
355
356       The equal function for int64s.
357
358
359       Since 4.03.0
360
361
362
363       val min : t -> t -> t
364
365       Return the smaller of the two arguments.
366
367
368       Since 4.13.0
369
370
371
372       val max : t -> t -> t
373
374       Return the greater of the two arguments.
375
376
377       Since 4.13.0
378
379
380
381
382
383OCamldoc                          2022-07-22                          Int64(3)
Impressum