package containers
Install
Dune Dependency
Authors
Maintainers
Sources
md5=efbef89f1e3460225c7d03e3ae2af62e
sha512=e3b43af275a660c46e7ded32c1a6e51396589a25af7b64187d044bcbfd05f5143f9024c4655921c606b86b99d0ab73e81c99dc75b23d52601682491c1b6abc9f
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]
.