Macaulay2 » Documentation
Packages » ForeignFunctions :: mpzT
next | previous | forward | backward | up | index | toc

mpzT -- GMP arbitrary-precision integer type

Description

Macaulay2's native ZZ integer type wraps around mpz_t from GMP. This type (which is an instance of ForeignIntegerType) allows for conversion between Macaulay2 integers and GMP integers without loss of precision.

i1 : mpzT 2^100

o1 = 1267650600228229401496703205376

o1 : ForeignObject of type mpz_t
i2 : value oo

o2 = 1267650600228229401496703205376
i3 : mpzAdd = foreignFunction("__gmpz_add", void, {mpzT, mpzT, mpzT})

o3 = __gmpz_add

o3 : ForeignFunction
i4 : x = mpzT 0

o4 = 0

o4 : ForeignObject of type mpz_t
i5 : mpzAdd(x, 2, 3)
i6 : x

o6 = 5

o6 : ForeignObject of type mpz_t

Methods that use an object of class mpzT :

For the programmer

The object mpzT is a foreign integer type, with ancestor classes ForeignObject < HashTable < Thing.