Module Numeral
Arbitrary precision integers
- author
- Christoph Sticksel
Pretty-printing and String Representation
val pp_print_numeral : Stdlib.Format.formatter -> t -> unit
Pretty-print a numeral, e.g. -1
val pp_print_numeral_sexpr : Stdlib.Format.formatter -> t -> unit
Pretty-print a numeral in s-expression, e.g. (- 1)
val string_of_numeral : t -> string
Return a string representation of a numeral
Conversions
val of_int : int -> t
Convert an integer to a numeral
val of_big_int : Big_int.big_int -> t
Convert an arbitrary large integer numeral to numeral
val of_string : string -> t
Convert a string to numeral
val to_int : t -> int
Convert a numeral to an integer
Raises the exception
Failure "int_of_big_int"
if the numeral cannot be represented as an integer.
val to_big_int : t -> Big_int.big_int
Convert a numeral to an arbitrary large integer
Constructors
val zero : t
The numeral zero
val one : t
The numeral one
Arithmetic operations
val incr : t Stdlib.ref -> unit
Increment a numeral in a reference by one
val decr : t Stdlib.ref -> unit
Decrement a numeral in a reference by one