module Safe_int:Safe operations on integers.sig..end
This module provides operations on the type int of
integers. Values of this type may be either 31 bits on 32-bit
processors or 63 bits on 64-bit processors. Operations which
overflow raise exception Number.Overflow.
This module implements Number.Numeric,
Number.Bounded, Number.Discrete.
Important note Untested.
typet =int
val zero : t0.val one : t1.val minus_one : t-1.val neg : t -> tval add : t -> t -> tval (+) : t -> t -> tval sub : t -> t -> tval (-) : t -> t -> tval mul : t -> t -> tval ( * ) : t -> t -> tval div : t -> t -> tDivision_by_zero if the second
argument is zero. This division rounds the real quotient of
its arguments towards zero, as specified for Pervasives.(/).val (/) : t -> t -> tDivision_by_zero if the second
argument is zero. This division rounds the real quotient of
its arguments towards zero, as specified for Pervasives.(/).val rem : t -> t -> ty is not zero, the result
of Int.rem x y satisfies the following property:
x = Int.add (Int.mul (Int.div x y) y) (Int.rem x y).
If y = 0, Int.rem x y raises Division_by_zero.val modulo : t -> t -> tmodulo a b computes the remainder of the integer
division of a by b. This is defined only if b <> 0.
The result of modulo a b is a number m between
0 and abs ( b - 1 ) if a >= 0 or between ~- ( abs ( b - 1 ) )
if a < 0 and such that a * k + (abs b) = m,
for some k.
val pow : t -> t -> tpow a b computes abval ( ** ) : t -> t -> ta ** b computes abval (<>) : t -> t -> boola <> b is true if and only if a and b have
different values.val (>) : t -> t -> boola > b is true if and only if a is strictly greater than b.val (<) : t -> t -> boola < b is true if and only if a is strictly smaller than b.val (>=) : t -> t -> boola >= b is true if and only if a is greater or equal to b.val (<=) : t -> t -> boola <= b is true if and only if a is smaller or equalto b.val (=) : t -> t -> boola = b if and only if a and b have the same value.val min_num : tval max_num : tval succ : t -> tsucc x is add x one.val pred : t -> tpred x is sub x one.val abs : t -> tval of_float : float -> tInt.min_int, Int.max_int].val to_float : t -> floatval of_string : string -> t0x, 0o or 0b
respectively.
Raise Invalid_argument "int_of_string" if the given string is not
a valid representation of an integer, or if the integer represented
exceeds the range of integers representable in type int.val to_string : t -> stringval compare : t -> t -> intPervasives.compare. Along with the type t, this function compare
allows the module Int to be passed as argument to the functors
Set.Make and Map.Make.val operations : t BatNumber.numericval of_int : int -> tval to_int : t -> intval print : 'a BatInnerIO.output -> t -> unit