gmp_lib.mpq_numref Method

GMP Native Interface for .NET

gmp_libmpq_numref Method
Return a reference to the numerator op.

Namespace:  Math.Gmp.Native
Assembly:  Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static mpz_t mpq_numref(
	mpq_t op
)
Public Shared Function mpq_numref ( 
	op As mpq_t
) As mpz_t
public:
static mpz_t^ mpq_numref(
	mpq_t^ op
)
static member mpq_numref : 
        op : mpq_t -> mpz_t 

Parameters

op
Type: Math.Gmp.Nativempq_t
The operand rational.

Return Value

Type: mpz_t
Return a reference to the numerator op.
Remarks

The mpz functions can be used on the returned reference.

Examples
// Create, initialize, and set the value of op to -1 / 3.
mpq_t op = new mpq_t();
gmp_lib.mpq_init(op);
gmp_lib.mpq_set_si(op, -1, 3U);

// Get reference to numerator, and increment it by 2.
mpz_t num = gmp_lib.mpq_numref(op);
gmp_lib.mpz_add_ui(num, num, 2U);

// Assert that op is 1 / 3.
Assert.IsTrue(gmp_lib.mpq_cmp_si(op, 1, 3U) == 0);

// Release unmanaged memory allocated for op.
gmp_lib.mpq_clear(op);
' Create, initialize, and set the value of op to -1 / 3.
Dim op As New mpq_t()
gmp_lib.mpq_init(op)
gmp_lib.mpq_set_si(op, -1, 3UI)

' Get reference to numerator, and increment it by 2.
Dim num As mpz_t = gmp_lib.mpq_numref(op)
gmp_lib.mpz_add_ui(num, num, 2UI)

' Assert that op is 1 / 3.
Assert.IsTrue(gmp_lib.mpq_cmp_si(op, 1, 3UI) = 0)

' Release unmanaged memory allocated for op.
gmp_lib.mpq_clear(op)

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also