Module `Extraction_plugin.Big`

`type big_int`` = Big_int.big_int`

The type of big integers.

`val zero : Big_int.big_int`

The big integer `0`.

`val one : Big_int.big_int`

The big integer `1`.

`val two : Big_int.big_int`

The big integer `2`.

Arithmetic operations
`val opp : Big_int.big_int -> Big_int.big_int`

Unary negation.

`val abs : Big_int.big_int -> Big_int.big_int`

Absolute value.

`val add : Big_int.big_int -> Big_int.big_int -> Big_int.big_int`

`val succ : Big_int.big_int -> Big_int.big_int`

`val add_int : int -> Big_int.big_int -> Big_int.big_int`

Addition of a small integer to a big integer.

`val sub : Big_int.big_int -> Big_int.big_int -> Big_int.big_int`

Subtraction.

`val pred : Big_int.big_int -> Big_int.big_int`

Predecessor (subtract 1).

`val mult : Big_int.big_int -> Big_int.big_int -> Big_int.big_int`

Multiplication of two big integers.

`val mult_int : int -> Big_int.big_int -> Big_int.big_int`

Multiplication of a big integer by a small integer

`val square : Big_int.big_int -> Big_int.big_int`

Return the square of the given big integer

`val sqrt : Big_int.big_int -> Big_int.big_int`

`sqrt_big_int a` returns the integer square root of `a`, that is, the largest big integer `r` such that `r * r <= a`. Raise `Invalid_argument` if `a` is negative.

`val quomod : Big_int.big_int -> Big_int.big_int -> Big_int.big_int * Big_int.big_int`

Euclidean division of two big integers. The first part of the result is the quotient, the second part is the remainder. Writing `(q,r) = quomod_big_int a b`, we have `a = q * b + r` and `0 <= r < |b|`. Raise `Division_by_zero` if the divisor is zero.

`val div : Big_int.big_int -> Big_int.big_int -> Big_int.big_int`

Euclidean quotient of two big integers. This is the first result `q` of `quomod_big_int` (see above).

`val modulo : Big_int.big_int -> Big_int.big_int -> Big_int.big_int`

Euclidean modulus of two big integers. This is the second result `r` of `quomod_big_int` (see above).

`val gcd : Big_int.big_int -> Big_int.big_int -> Big_int.big_int`

Greatest common divisor of two big integers.

`val power : Big_int.big_int -> Big_int.big_int -> Big_int.big_int`

Exponentiation functions. Return the big integer representing the first argument `a` raised to the power `b` (the second argument). Depending on the function, `a` and `b` can be either small integers or big integers. Raise `Invalid_argument` if `b` is negative.

Comparisons and tests
`val sign : Big_int.big_int -> int`

Return `0` if the given big integer is zero, `1` if it is positive, and `-1` if it is negative.

`val compare : Big_int.big_int -> Big_int.big_int -> int`

`compare_big_int a b` returns `0` if `a` and `b` are equal, `1` if `a` is greater than `b`, and `-1` if `a` is smaller than `b`.

`val eq : Big_int.big_int -> Big_int.big_int -> bool`
`val le : Big_int.big_int -> Big_int.big_int -> bool`
`val ge : Big_int.big_int -> Big_int.big_int -> bool`
`val lt : Big_int.big_int -> Big_int.big_int -> bool`
`val gt : Big_int.big_int -> Big_int.big_int -> bool`

Usual boolean comparisons between two big integers.

`val max : Big_int.big_int -> Big_int.big_int -> Big_int.big_int`

Return the greater of its two arguments.

`val min : Big_int.big_int -> Big_int.big_int -> Big_int.big_int`

Return the smaller of its two arguments.

Conversions to and from strings
`val to_string : Big_int.big_int -> string`

Return the string representation of the given big integer, in decimal (base 10).

`val of_string : string -> Big_int.big_int`

Convert a string to a big integer, in decimal. The string consists of an optional `-` or `+` sign, followed by one or several decimal digits.

Conversions to and from other numerical types
`val of_int : int -> Big_int.big_int`

Convert a small integer to a big integer.

`val is_int : Big_int.big_int -> bool`

Test whether the given big integer is small enough to be representable as a small integer (type `int`) without loss of precision. On a 32-bit platform, `is_int_big_int a` returns `true` if and only if `a` is between 230 and 230-1. On a 64-bit platform, `is_int_big_int a` returns `true` if and only if `a` is between -262 and 262-1.

`val to_int : Big_int.big_int -> int`

Convert a big integer to a small integer (type `int`). Raises `Failure "int_of_big_int"` if the big integer is not representable as a small integer.

`val double : Big_int.big_int -> Big_int.big_int`
`val doubleplusone : Big_int.big_int -> Big_int.big_int`
`val nat_case : (unit -> 'a) -> (Big_int.big_int -> 'a) -> Big_int.big_int -> 'a`
`val positive_case : (Big_int.big_int -> 'a) -> (Big_int.big_int -> 'a) -> (unit -> 'a) -> Big_int.big_int -> 'a`
`val n_case : (unit -> 'a) -> (Big_int.big_int -> 'a) -> Big_int.big_int -> 'a`
`val z_case : (unit -> 'a) -> (Big_int.big_int -> 'a) -> (Big_int.big_int -> 'a) -> Big_int.big_int -> 'a`
`val compare_case : 'a -> 'a -> 'a -> Big_int.big_int -> Big_int.big_int -> 'a`
`val nat_rec : 'a -> ('a -> 'a) -> Big_int.big_int -> 'a`
`val positive_rec : ('a -> 'a) -> ('a -> 'a) -> 'a -> Big_int.big_int -> 'a`
`val z_rec : 'a -> (Big_int.big_int -> 'a) -> (Big_int.big_int -> 'a) -> Big_int.big_int -> 'a`