module type S =sig
..end
type
t
val typerep_of_t : t Typerep_lib.Std.Typerep.t
val typename_of_t : t Typerep_lib.Std.Typename.t
include Floatable
include Intable
include Identifiable
include Comparable.With_zero
include Int_intf.Hexable
val to_string_hum : ?delimiter:char -> t -> string
delimiter
is underscore by defaultval num_bits : int
val zero : t
val one : t
val minus_one : t
val (+) : t -> t -> t
val (-) : t -> t -> t
val ( * ) : t -> t -> t
val neg : t -> t
val (~-) : t -> t
val (/%) : t -> t -> t
/%
and %
, and
/
and rem
. They both satisfy the same equation relating the quotient and the
remainder:
x = (x /% y) * y + (x % y);
x = (x / y) * y + (rem x y);
The functions return the same values if x
and y
are positive. They all raise
if y = 0
.
The functions differ if x < 0
or y < 0
.
If y < 0
, then %
and /%
raise, whereas /
and rem
do not.
x % y
always returns a value between 0 and y - 1
, even when x < 0
. On the
other hand, rem x y
returns a negative value if and only if x < 0
; that value
satisfies abs (rem x y) <= abs y - 1
.
val (%) : t -> t -> t
val (/) : t -> t -> t
val rem : t -> t -> t
val (//) : t -> t -> float
module O:sig
..end
val succ : t -> t
val pred : t -> t
val abs : t -> t
min_value
include Int_intf.Round
val pow : t -> t -> t
pow base exponent
returns base
raised to the power of exponent
. It is OK if
base <= 0
. pow
raises if exponent < 0
, or an integer overflow would occur.val max_value : t
The smallest representable integer
val min_value : t
val bit_and : t -> t -> t
val bit_or : t -> t -> t
val bit_xor : t -> t -> t
val bit_not : t -> t
The results are unspecified for negative shifts and shifts >= num_bits
val shift_left : t -> int -> t
shifts right, preserving the sign of the input.
val shift_right : t -> int -> t
val shift_right_logical : t -> int -> t
val decr : t Pervasives.ref -> unit
val incr : t Pervasives.ref -> unit
val of_int32_exn : int32 -> t
val to_int32_exn : t -> int32
val of_int64_exn : int64 -> t
val to_int64 : t -> int64
val of_nativeint_exn : nativeint -> t
val to_nativeint_exn : t -> nativeint
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val bin_t : t Bin_prot.Type_class.t
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_writer_t : t Bin_prot.Type_class.writer
delimiter
is underscore by default/%
and %
, and
/
and rem
. They both satisfy the same equation relating the quotient and the
remainder:
x = (x /% y) * y + (x % y);
x = (x / y) * y + (rem x y);
The functions return the same values if x
and y
are positive. They all raise
if y = 0
.
The functions differ if x < 0
or y < 0
.
If y < 0
, then %
and /%
raise, whereas /
and rem
do not.
x % y
always returns a value between 0 and y - 1
, even when x < 0
. On the
other hand, rem x y
returns a negative value if and only if x < 0
; that value
satisfies abs (rem x y) <= abs y - 1
.
float division of integers
A sub-module designed to be opened to make working with ints more convenient.
min_value
pow base exponent
returns base
raised to the power of exponent
. It is OK if
base <= 0
. pow
raises if exponent < 0
, or an integer overflow would occur.
The results are unspecified for negative shifts and shifts >= num_bits
shifts left, filling in with zeroes
shifts right, preserving the sign of the input.
shifts right, filling in with zeroes, which will not preserve the sign of the
input