Method Gmp.mpz()->create()


Method create

Gmp.mpz Gmp.mpz()
Gmp.mpz Gmp.mpz(string|int|float|object value)
Gmp.mpz Gmp.mpz(string value, int(2..62)|int(256)|int(-256) base)

Description

Create and initialize a Gmp.mpz object.

Parameter value

Initial value. If no value is specified, the object will be initialized to zero.

Parameter base

Base the value is specified in. The default base is base 10. The base can be either a value in the range [2..36] (inclusive), in which case the numbers are taken from the ASCII range 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ (case-insensitive), in the range [37..62] (inclusive), in which case the ASCII range will be case sensitive, or either of the values 256 or -256, in which case value is taken to be the unsigned binary representation in network byte order or reversed byte order respectively.

Values in base [2..62] can be prefixed with "+" or "-". If no base is given, values prefixed with "0b" or "0B" will be interpreted as binary. Values prefixed with "0x" or "0X" will be interpreted as hexadecimal. Values prefixed with "0" will be interpreted as octal.

Note

Leading zeroes in value are not significant when a base is explicitly given. In particular leading NUL characters are not preserved in the base 256 modes.

Before GMP 5.0 only bases 2-36 and 256 were supported.