CCIntSourceBasic Int functions
A seeded hash function for ints, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.
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].
include module type of Infix