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).  If the truncated float‐
214       ing-point number is outside the range [ Int32.min_int  ,  Int32.max_int
215       ], no exception is raised, and an unspecified, platform-dependent inte‐
216       ger is returned.
217
218
219
220       val to_float : int32 -> float
221
222       Convert the given 32-bit integer to a floating-point number.
223
224
225
226       val of_string : string -> int32
227
228       Convert the given string to a 32-bit integer.  The string  is  read  in
229       decimal  (by default, or if the string begins with 0u ) or in hexadeci‐
230       mal, octal or binary if the string begins with 0x , 0o  or  0b  respec‐
231       tively.
232
233       The  0u  prefix reads the input as an unsigned integer in the range [0,
234       2*Int32.max_int+1] .  If the input exceeds  Int32.max_int  it  is  con‐
235       verted  to the signed integer Int32.min_int + input - Int32.max_int - 1
236       .
237
238       The _ (underscore) character can appear anywhere in the string  and  is
239       ignored.
240
241
242       Raises  Failure if the given string is not a valid representation of an
243       integer, or if the integer represented exceeds the  range  of  integers
244       representable in type int32 .
245
246
247
248       val of_string_opt : string -> int32 option
249
250       Same as of_string , but return None instead of raising.
251
252
253       Since 4.05
254
255
256
257       val to_string : int32 -> string
258
259       Return the string representation of its argument, in signed decimal.
260
261
262
263       val bits_of_float : float -> int32
264
265       Return  the internal representation of the given float according to the
266       IEEE 754 floating-point 'single format' bit layout.  Bit 31 of the  re‐
267       sult represents the sign of the float; bits 30 to 23 represent the (bi‐
268       ased) exponent; bits 22 to 0 represent the mantissa.
269
270
271
272       val float_of_bits : int32 -> float
273
274       Return the floating-point number whose internal representation, accord‐
275       ing  to  the IEEE 754 floating-point 'single format' bit layout, is the
276       given int32 .
277
278
279       type t = int32
280
281
282       An alias for the type of 32-bit integers.
283
284
285
286       val compare : t -> t -> int
287
288       The comparison function for 32-bit integers, with the  same  specifica‐
289       tion as compare .  Along with the type t , this function compare allows
290       the module Int32 to be passed as argument to the functors Set.Make  and
291       Map.Make .
292
293
294
295       val unsigned_compare : t -> t -> int
296
297       Same  as  Int32.compare  , except that arguments are interpreted as un‐
298       signed 32-bit integers.
299
300
301       Since 4.08.0
302
303
304
305       val equal : t -> t -> bool
306
307       The equal function for int32s.
308
309
310       Since 4.03.0
311
312
313
314       val min : t -> t -> t
315
316       Return the smaller of the two arguments.
317
318
319       Since 4.13.0
320
321
322
323       val max : t -> t -> t
324
325       Return the greater of the two arguments.
326
327
328       Since 4.13.0
329
330
331
332
333
334OCamldoc                          2022-07-22                   Stdlib.Int32(3)
Impressum