int: operations on integers

Integers are 31 bits wide (or 63 bits on 64-bit processors). All operations are taken modulo 2^{31} (or 2^{63}). They do not fail on overflow.
```exception Division_by_zero
value minus : int -> int
value minus_int : int -> int
```
Unary negation. You can write -e instead of minus e.
```value succ : int -> int
```
succ x is x+1.
```value pred : int -> int
```
pred x is x-1.
```value prefix + : int -> int -> int
value add_int : int -> int -> int
```
```value prefix - : int -> int -> int
value sub_int : int -> int -> int
```
Subtraction.
```value prefix * : int -> int -> int
value mult_int : int -> int -> int
```
Multiplication.
```value prefix / : int -> int -> int
value div_int : int -> int -> int
value prefix quo : int -> int -> int
```
Integer division. Raise Division_by_zero if the second argument is 0. Give unpredictable results if either argument is negative.
```value prefix mod : int -> int -> int
```
Remainder. Raise Division_by_zero if the second argument is 0. Give unpredictable results if either argument is negative.
```value eq_int : int -> int -> bool
```
Integer equality. Equivalent to generic equality, just faster.
```value neq_int : int -> int -> bool
```
Negation of eq_int.
```value lt_int : int -> int -> bool
value gt_int : int -> int -> bool
value le_int : int -> int -> bool
value ge_int : int -> int -> bool
```
Usual comparisons between integers.
```value abs : int -> int
```
Return the absolute value of the argument.
```value max_int : int
value min_int : int
```
The greatest and smallest integer values.

Bitwise operations

```value prefix land : int -> int -> int
```
Bitwise logical and.
```value prefix lor : int -> int -> int
```
Bitwise logical or.
```value prefix lxor : int -> int -> int
```
Bitwise logical exclusive or.
```value lnot : int -> int
```
Bitwise complement
```value prefix lsl : int -> int -> int
value lshift_left : int -> int -> int
```
n lsl m, or equivalently lshift_left n m, shifts n to the left by m bits.
```value prefix lsr : int -> int -> int
```
n lsr m shifts n to the right by m bits. This is a logical shift: zeroes are inserted regardless of sign.
```value prefix asr : int -> int -> int
value lshift_right : int -> int -> int
```
n asr m, or equivalently lshift_right n m, shifts n to the right by m bits. This is an arithmetic shift: the sign bit is replicated.

Conversion functions

```value string_of_int : int -> string
```
Convert the given integer to its decimal representation.
```value int_of_string : string -> int
```
Convert the given string to an integer, in decimal (by default) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b. Raise Failure "int_of_string" if the given string is not a valid representation of an integer.