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

NAME

6       Int32 - 32-bit integers.
7

Module

9       Module   Int32
10

Documentation

12       Module Int32
13        : sig end
14
15
16       32-bit integers.
17
18       This  module  provides  operations  on  the type int32 of signed 32-bit
19       integers.  Unlike the built-in int type, the type int32  is  guaranteed
20       to  be exactly 32-bit wide on all platforms.  All arithmetic operations
21       over int32 are taken modulo 2^{32.
22
23       Performance notice: values of type int32 occupy more memory space  than
24       values  of  type int , and arithmetic operations on int32 are generally
25       slower than those on  int  .   Use  int32  only  when  the  application
26       requires exact 32-bit arithmetic.
27
28
29
30
31
32
33
34       val zero : int32
35
36       The 32-bit integer 0.
37
38
39
40
41       val one : int32
42
43       The 32-bit integer 1.
44
45
46
47
48       val minus_one : int32
49
50       The 32-bit integer -1.
51
52
53
54
55       val neg : int32 -> int32
56
57       Unary negation.
58
59
60
61
62       val add : int32 -> int32 -> int32
63
64       Addition.
65
66
67
68
69       val sub : int32 -> int32 -> int32
70
71       Subtraction.
72
73
74
75
76       val mul : int32 -> int32 -> int32
77
78       Multiplication.
79
80
81
82
83       val div : int32 -> int32 -> int32
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 : int32 -> int32 -> int32
93
94       Integer  remainder.  If y is not zero, the result of Int32.rem x y sat‐
95       isfies the following property: x = Int32.add (Int32.mul (Int32.div x y)
96       y)  (Int32.rem x y) .  If y = 0 , Int32.rem x y raises Division_by_zero
97       .
98
99
100
101
102       val succ : int32 -> int32
103
104       Successor.  Int32.succ x is Int32.add x Int32.one .
105
106
107
108
109       val pred : int32 -> int32
110
111       Predecessor.  Int32.pred x is Int32.sub x Int32.one .
112
113
114
115
116       val abs : int32 -> int32
117
118       Return the absolute value of its argument.
119
120
121
122
123       val max_int : int32
124
125       The greatest representable 32-bit integer, 2^{31 - 1.
126
127
128
129
130       val min_int : int32
131
132       The smallest representable 32-bit integer, -2^{31.
133
134
135
136
137       val logand : int32 -> int32 -> int32
138
139       Bitwise logical and.
140
141
142
143
144       val logor : int32 -> int32 -> int32
145
146       Bitwise logical or.
147
148
149
150
151       val logxor : int32 -> int32 -> int32
152
153       Bitwise logical exclusive or.
154
155
156
157
158       val lognot : int32 -> int32
159
160       Bitwise logical negation
161
162
163
164
165       val shift_left : int32 -> int -> int32
166
167
168       Int32.shift_left x y shifts x to the left by y  bits.   The  result  is
169       unspecified if y < 0 or y >= 32 .
170
171
172
173
174       val shift_right : int32 -> int -> int32
175
176
177       Int32.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 >= 32 .
180
181
182
183
184       val shift_right_logical : int32 -> int -> int32
185
186
187       Int32.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 >= 32 .
190
191
192
193
194       val of_int : int -> int32
195
196       Convert  the  given integer (type int ) to a 32-bit integer (type int32
197       ).
198
199
200
201
202       val to_int : int32 -> int
203
204       Convert the given 32-bit integer (type int32 ) to an integer (type  int
205       ).  On 32-bit platforms, the 32-bit integer is taken modulo 2^{31, i.e.
206       the high-order bit is lost during the conversion.  On 64-bit platforms,
207       the conversion is exact.
208
209
210
211
212       val of_float : float -> int32
213
214       Convert the given floating-point number to a 32-bit integer, discarding
215       the fractional part (truncate towards 0).  The result of the conversion
216       is  undefined  if,  after truncation, the number is outside the range [
217       Int32.min_int , Int32.max_int ].
218
219
220
221
222       val to_float : int32 -> float
223
224       Convert the given 32-bit integer to a floating-point number.
225
226
227
228
229       val of_string : string -> int32
230
231       Convert the given string to a 32-bit integer.  The string  is  read  in
232       decimal  (by  default) or in hexadecimal, octal or binary if the string
233       begins with 0x , 0o or 0b respectively.  Raise Failure int_of_string if
234       the given string is not a valid representation of an integer, or if the
235       integer represented exceeds the range of integers representable in type
236       int32 .
237
238
239
240
241       val to_string : int32 -> string
242
243       Return the string representation of its argument, in signed decimal.
244
245
246
247
248       val bits_of_float : float -> int32
249
250       Return  the internal representation of the given float according to the
251       IEEE 754 floating-point ``single format'' bit layout.  Bit  31  of  the
252       result  represents  the  sign of the float; bits 30 to 23 represent the
253       (biased) exponent; bits 22 to 0 represent the mantissa.
254
255
256
257
258       val float_of_bits : int32 -> float
259
260       Return the floating-point number whose internal representation, accord‐
261       ing to the IEEE 754 floating-point ``single format'' bit layout, is the
262       given int32 .
263
264
265
266       type t = int32
267
268
269       An alias for the type of 32-bit integers.
270
271
272
273
274       val compare : t -> t -> int
275
276       The comparison function for 32-bit integers, with the  same  specifica‐
277       tion  as  Pervasives.compare  .   Along with the type t , this function
278       compare allows the module Int32 to be passed as argument to  the  func‐
279       tors Set.Make and Map.Make .
280
281
282
283
284
285
286OCamldoc                          2010-01-29                          Int32(3)
Impressum