module Int32 = struct ... end
Simple values | |
zero |
int32 |
one |
int32 |
minus_one |
int32 The 32-bit integers 0, 1, -1. |
max_int |
int32 |
min_int |
int32 |
Functions |
neg
: int32 -> int32 |
add
: int32 -> int32 -> int32 |
sub
: int32 -> int32 -> int32 |
mul
: int32 -> int32 -> int32 |
div
: int32 -> int32 -> int32 |
Division_by_zero
if the second
argument is zero.
rem
: int32 -> int32 -> int32 |
x >= 0
and y > 0
, the result
of Int32.rem x y
satisfies the following properties:
0 <= Int32.rem x y < y
and
x = Int32.add (Int32.mul (Int32.div x y) y) (Int32.rem x y)
.
If y = 0
, Int32.rem x y
raises Division_by_zero
.
If x < 0
or y < 0
, the result of Int32.rem x y
is
not specified and depends on the platform.
succ
: int32 -> int32 |
Int32.succ x
is Int32.add x Int32.one
.
pred
: int32 -> int32 |
Int32.pred x
is Int32.sub x Int32.one
.
abs
: int32 -> int32 |
logand
: int32 -> int32 -> int32 |
logor
: int32 -> int32 -> int32 |
logxor
: int32 -> int32 -> int32 |
lognot
: int32 -> int32 |
shift_left
: int32 -> int -> int32 |
Int32.shift_left x y
shifts x
to the left by y
bits.
The result is unspecified if y < 0
or y >= 32
.
shift_right
: int32 -> int -> int32 |
Int32.shift_right x y
shifts x
to the right by y
bits.
This is an arithmetic shift: the sign bit of x
is replicated
and inserted in the vacated bits.
The result is unspecified if y < 0
or y >= 32
.
shift_right_logical
: int32 -> int -> int32 |
Int32.shift_right_logical x y
shifts x
to the right by y
bits.
This is a logical shift: zeroes are inserted in the vacated bits
regardless of the sign of x
.
The result is unspecified if y < 0
or y >= 32
.
of_int
: int -> int32 |
int
) to a 32-bit integer
(type int32
).
to_int
: int32 -> int |
of_float
: float -> int32 |
Int32.min_int, Int32.max_int
.
to_float
: int32 -> float |
of_string
: string -> int32 |
0x
, 0o
or 0b
respectively.
Raise Failure "int_of_string"
if the given string is not
a valid representation of an integer.
to_string
: int32 -> string |
format
: string -> int32 -> string |
Int32.format fmt n
return the string representation of the
32-bit integer n
in the format specified by fmt
.
fmt
is a Printf
-style format containing exactly
one %d
, %i
, %u
, %x
, %X
or %o
conversion specification.
See the documentation of the Printf
module for more information,