Module CCInt
Basic Int functions
include module type of CCShimsInt_
Documentation for the standard Int module
include Stdlib.Int
val neg : int -> intval add : int -> int -> intval sub : int -> int -> intval mul : int -> int -> intval div : int -> int -> intval rem : int -> int -> intval succ : int -> intval pred : int -> int
val zero : tzerois the integer0.- since
- 3.0
val one : toneis the integer1.- since
- 3.0
val minus_one : tminus_oneis the integer-1.- since
- 3.0
val abs : t -> tabs xis the absolute value ofx. It isxifxis positive andneg xotherwise.- since
- 3.0
val max_int : tmax_intis the maximum integer.- since
- 3.0
val min_int : tmin_intis the minimum integer.- since
- 3.0
val compare : t -> t -> intcompare x yis the comparison function for integers with the same specification asStdlib.compare.
val hash : t -> inthash xcomputes the hash ofx.
val sign : t -> intsign xreturn0ifx = 0,-1ifx < 0and1ifx > 0. Same ascompare x 0.
val pow : t -> t -> tpow base exponentreturnsbaseraised to the power ofexponent.pow x y = x^yfor positive integersxandy. RaisesInvalid_argumentifx = y = 0ory< 0.- since
- 0.11
val floor_div : t -> t -> tfloor_div x nis integer division rounding towards negative infinity. It satisfiesx = m * floor_div x n + rem x n.- since
- 1.2
type 'a printer= Stdlib.Format.formatter -> 'a -> unittype 'a random_gen= Stdlib.Random.State.t -> 'atype 'a iter= ('a -> unit) -> unit
val random : int -> t random_genval random_small : t random_genval random_range : int -> int -> t random_genval pp : t printerpp ppf xprints the integerxonppf.
val to_float : t -> floatto_floatis the same asfloat_of_int- since
- 3.0
val of_float : float -> tto_floatis the same asint_of_float- since
- 3.0
val to_string : t -> stringto_string xreturns the string representation of the integerx, in signed decimal.- since
- 0.13
val of_string : string -> t optionof_string sconverts the given stringsinto an integer. Safe version ofof_string_exn.- since
- 0.13
val of_string_exn : string -> tof_string_exn sconverts the given stringsto an integer. Alias toint_of_string.- raises Failure
in case of failure.
- since
- 3.0
val of_float : float -> tof_float xconverts the given floating-point numberxto an integer. Alias toint_of_float.- since
- 3.0
val to_string_binary : t -> stringto_string_binary xreturns the string representation of the integerx, in binary.- since
- 0.20
val range_by : step:t -> t -> t -> t iterrange_by ~step i jiterates on integers fromitojincluded, where the difference between successive elements isstep. Use a negativestepfor a decreasing list.- raises Invalid_argument
if
step=0.
- since
- 1.2
val range : t -> t -> t iterrange i jiterates on integers fromitojincluded . It works both for decreasing and increasing ranges.- since
- 1.2
val range' : t -> t -> t iterrange' i jis likerangebut the second boundjis excluded. For instancerange' 0 5 = Iter.of_list [0;1;2;3;4].- since
- 1.2
val popcount : t -> intNumber of bits set to 1
- since
- 3.0
Infix Operators
- since
- 0.17
module Infix : sig ... end