gmp_lib.mpq_get_den Method

GMP Native Interface for .NET

gmp_libmpq_get_den Method
Set denominator to the denominator of rational.

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 void mpq_get_den(
	mpz_t denominator,
	mpq_t rational
)
Public Shared Sub mpq_get_den ( 
	denominator As mpz_t,
	rational As mpq_t
)
public:
static void mpq_get_den(
	mpz_t^ denominator, 
	mpq_t^ rational
)
static member mpq_get_den : 
        denominator : mpz_t * 
        rational : mpq_t -> unit 

Parameters

denominator
Type: Math.Gmp.Nativempz_t
The result integer.
rational
Type: Math.Gmp.Nativempq_t
The operand rational.
Remarks

The function is equivalent to calling mpz_set with mpq_denref. Direct use of mpq_denref is recommended instead of this functions.

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);

// Create and initialize a new integer.
mpz_t den = new mpz_t();
gmp_lib.mpz_init(den);

// Set integer to numerator of rational, and increment integer by 2..
gmp_lib.mpq_get_den(den, op);
gmp_lib.mpz_add_ui(den, den, 2U);

// Assert that num is 1, and op is -1 / 3.
Assert.IsTrue(gmp_lib.mpz_cmp_si(den, 5) == 0);
Assert.IsTrue(gmp_lib.mpq_cmp_si(op, -1, 3U) == 0);

// Release unmanaged memory allocated for op and num.
gmp_lib.mpq_clear(op);
gmp_lib.mpz_clear(den);
' 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)

' Create and initialize a new integer.
Dim den As New mpz_t()
gmp_lib.mpz_init(den)

' Set integer to numerator of rational, and increment integer by 2..
gmp_lib.mpq_get_den(den, op)
gmp_lib.mpz_add_ui(den, den, 2UI)

' Assert that num is 1, and op is -1 / 3.
Assert.IsTrue(gmp_lib.mpz_cmp_si(den, 5) = 0)
Assert.IsTrue(gmp_lib.mpq_cmp_si(op, -1, 3UI) = 0)

' Release unmanaged memory allocated for op and num.
gmp_lib.mpq_clear(op)
gmp_lib.mpz_clear(den)

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