1Stdlib.Int32(3)                  OCaml library                 Stdlib.Int32(3)
2
3
4

NAME

6       Stdlib.Int32 - no description
7

Module

9       Module   Stdlib.Int32
10

Documentation

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