package containers
Install
Dune Dependency
Authors
Maintainers
Sources
md5=8cd9d8ddf89a60d8f2b005163707ea0e
sha512=eaeaf87c20ef124b923e461ce108e97d368d5228dd737c83d78c53741e15a8d9bc2af97150efd266cb99c4af63a7a87de47a1c2f3c51725cf62fe4d53b46daa5
doc/containers/CCInt/index.html
Module CCInt
Source
Basic Int functions
include module type of CCShimsInt_
abs x
is the absolute value of x
. It is x
if x
is positive and neg x
otherwise.
compare x y
is the comparison function for integers with the same specification as Stdlib.compare
.
equal x y
is true
iff x
and y
are equal. Equality function for integers.
pow base exponent
returns base
raised to the power of exponent
. pow x y = x^y
for positive integers x
and y
. Raises Invalid_argument
if x = y = 0
or y
< 0.
floor_div x n
is integer division rounding towards negative infinity. It satisfies x = m * floor_div x n + rem x n
.
to_string x
returns the string representation of the integer x
, in signed decimal.
of_string s
converts the given string s
into an integer. Safe version of of_string_exn
.
of_string_exn s
converts the given string s
to an integer. Alias to int_of_string
.
of_float x
converts the given floating-point number x
to an integer. Alias to int_of_float
.
to_string_binary x
returns the string representation of the integer x
, in binary.
range_by ~step i j
iterates on integers from i
to j
included, where the difference between successive elements is step
. Use a negative step
for a decreasing list.
range i j
iterates on integers from i
to j
included . It works both for decreasing and increasing ranges.
range' i j
is like range
but the second bound j
is excluded. For instance range' 0 5 = Iter.of_list [0;1;2;3;4]
.