1Int64(3) OCaml library Int64(3)
2
3
4
6 Int64 - 64-bit integers.
7
9 Module Int64
10
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
19 integers. Unlike the built-in int type, the type int64 is guaranteed
20 to 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
26 requires exact 64-bit arithmetic.
27
28
29
30
31
32
33
34 val zero : int64
35
36 The 64-bit integer 0.
37
38
39
40
41 val one : int64
42
43 The 64-bit integer 1.
44
45
46
47
48 val minus_one : int64
49
50 The 64-bit integer -1.
51
52
53
54
55 val neg : int64 -> int64
56
57 Unary negation.
58
59
60
61
62 val add : int64 -> int64 -> int64
63
64 Addition.
65
66
67
68
69 val sub : int64 -> int64 -> int64
70
71 Subtraction.
72
73
74
75
76 val mul : int64 -> int64 -> int64
77
78 Multiplication.
79
80
81
82
83 val div : int64 -> int64 -> int64
84
85 Integer division. Raise Division_by_zero if the second argument is
86 zero. This division rounds the real quotient of its arguments towards
87 zero, as specified for Pervasives.(/) .
88
89
90
91
92 val rem : int64 -> int64 -> int64
93
94 Integer remainder. If y is not zero, the result of Int64.rem x y sat‐
95 isfies the following property: x = Int64.add (Int64.mul (Int64.div x y)
96 y) (Int64.rem x y) . If y = 0 , Int64.rem x y raises Division_by_zero
97 .
98
99
100
101
102 val succ : int64 -> int64
103
104 Successor. Int64.succ x is Int64.add x Int64.one .
105
106
107
108
109 val pred : int64 -> int64
110
111 Predecessor. Int64.pred x is Int64.sub x Int64.one .
112
113
114
115
116 val abs : int64 -> int64
117
118 Return the absolute value of its argument.
119
120
121
122
123 val max_int : int64
124
125 The greatest representable 64-bit integer, 2^{63 - 1.
126
127
128
129
130 val min_int : int64
131
132 The smallest representable 64-bit integer, -2^{63.
133
134
135
136
137 val logand : int64 -> int64 -> int64
138
139 Bitwise logical and.
140
141
142
143
144 val logor : int64 -> int64 -> int64
145
146 Bitwise logical or.
147
148
149
150
151 val logxor : int64 -> int64 -> int64
152
153 Bitwise logical exclusive or.
154
155
156
157
158 val lognot : int64 -> int64
159
160 Bitwise logical negation
161
162
163
164
165 val shift_left : int64 -> int -> int64
166
167
168 Int64.shift_left x y shifts x to the left by y bits. The result is
169 unspecified if y < 0 or y >= 64 .
170
171
172
173
174 val shift_right : int64 -> int -> int64
175
176
177 Int64.shift_right x y shifts x to the right by y bits. This is an
178 arithmetic shift: the sign bit of x is replicated and inserted in the
179 vacated bits. The result is unspecified if y < 0 or y >= 64 .
180
181
182
183
184 val shift_right_logical : int64 -> int -> int64
185
186
187 Int64.shift_right_logical x y shifts x to the right by y bits. This is
188 a logical shift: zeroes are inserted in the vacated bits regardless of
189 the sign of x . The result is unspecified if y < 0 or y >= 64 .
190
191
192
193
194 val of_int : int -> int64
195
196 Convert the given integer (type int ) to a 64-bit integer (type int64
197 ).
198
199
200
201
202 val to_int : int64 -> int
203
204 Convert the given 64-bit integer (type int64 ) to an integer (type int
205 ). On 64-bit platforms, the 64-bit integer is taken modulo 2^{63, i.e.
206 the high-order bit is lost during the conversion. On 32-bit platforms,
207 the 64-bit integer is taken modulo 2^{31, i.e. the top 33 bits are lost
208 during the conversion.
209
210
211
212
213 val of_float : float -> int64
214
215 Convert the given floating-point number to a 64-bit integer, discarding
216 the fractional part (truncate towards 0). The result of the conversion
217 is undefined if, after truncation, the number is outside the range [
218 Int64.min_int , Int64.max_int ].
219
220
221
222
223 val to_float : int64 -> float
224
225 Convert the given 64-bit integer to a floating-point number.
226
227
228
229
230 val of_int32 : int32 -> int64
231
232 Convert the given 32-bit integer (type int32 ) to a 64-bit integer
233 (type int64 ).
234
235
236
237
238 val to_int32 : int64 -> int32
239
240 Convert the given 64-bit integer (type int64 ) to a 32-bit integer
241 (type int32 ). The 64-bit integer is taken modulo 2^{32, i.e. the top
242 32 bits are lost during the conversion.
243
244
245
246
247 val of_nativeint : nativeint -> int64
248
249 Convert the given native integer (type nativeint ) to a 64-bit integer
250 (type int64 ).
251
252
253
254
255 val to_nativeint : int64 -> nativeint
256
257 Convert the given 64-bit integer (type int64 ) to a native integer. On
258 32-bit platforms, the 64-bit integer is taken modulo 2^{32. On 64-bit
259 platforms, the conversion is exact.
260
261
262
263
264 val of_string : string -> int64
265
266 Convert the given string to a 64-bit integer. The string is read in
267 decimal (by default) or in hexadecimal, octal or binary if the string
268 begins with 0x , 0o or 0b respectively. Raise Failure int_of_string if
269 the given string is not a valid representation of an integer, or if the
270 integer represented exceeds the range of integers representable in type
271 int64 .
272
273
274
275
276 val to_string : int64 -> string
277
278 Return the string representation of its argument, in decimal.
279
280
281
282
283 val bits_of_float : float -> int64
284
285 Return the internal representation of the given float according to the
286 IEEE 754 floating-point ``double format'' bit layout. Bit 63 of the
287 result represents the sign of the float; bits 62 to 52 represent the
288 (biased) exponent; bits 51 to 0 represent the mantissa.
289
290
291
292
293 val float_of_bits : int64 -> float
294
295 Return the floating-point number whose internal representation, accord‐
296 ing to the IEEE 754 floating-point ``double format'' bit layout, is the
297 given int64 .
298
299
300
301 type t = int64
302
303
304 An alias for the type of 64-bit integers.
305
306
307
308
309 val compare : t -> t -> int
310
311 The comparison function for 64-bit integers, with the same specifica‐
312 tion as Pervasives.compare . Along with the type t , this function
313 compare allows the module Int64 to be passed as argument to the func‐
314 tors Set.Make and Map.Make .
315
316
317
318
319
320
321OCamldoc 2017-03-22 Int64(3)