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