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

mpfrT -- MPFR multiple-precision floating-point type

Description

Macaulay2's native RR real number type wraps around mpfr_t from MPFR. This type (which is an instance of ForeignRealType) allows for conversion between Macaulay2 reals and MPFR reals without loss of precision.

i1 : mpfrT numeric(100, pi)

o1 = 3.14159265358979323846264338328

o1 : ForeignObject of type mpfr_t
i2 : value oo

o2 = 3.14159265358979323846264338328

o2 : RR (of precision 100)
i3 : mpfrAdd = foreignFunction("mpfr_add", void, {mpfrT, mpfrT, mpfrT, int})

o3 = mpfr_add

o3 : ForeignFunction
i4 : x = mpfrT 0p100

o4 = 0

o4 : ForeignObject of type mpfr_t
i5 : mpfrAdd(x, numeric(100, pi), exp 1p100, 0)
i6 : x

o6 = 5.85987448204883847382293085463

o6 : ForeignObject of type mpfr_t

Methods that use an object of class mpfrT :

For the programmer

The object mpfrT is a foreign real type, with ancestor classes ForeignObject < HashTable < Thing.