gmp_lib.mpq_cmp_ui Method

GMP Native Interface for .NET

gmp_libmpq_cmp_ui Method
Compare op1 and num2 / den2.

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 int mpq_cmp_ui(
	mpq_t op1,
	uint num2,
	uint den2
)
Public Shared Function mpq_cmp_ui ( 
	op1 As mpq_t,
	num2 As UInteger,
	den2 As UInteger
) As Integer
public:
static int mpq_cmp_ui(
	mpq_t^ op1, 
	unsigned int num2, 
	unsigned int den2
)
static member mpq_cmp_ui : 
        op1 : mpq_t * 
        num2 : uint32 * 
        den2 : uint32 -> int 

Parameters

op1
Type: Math.Gmp.Nativempq_t
The first operand rational.
num2
Type: SystemUInt32
The second operand numerator integer.
den2
Type: SystemUInt32
The second operand denominator integer.

Return Value

Type: Int32
Return a positive value if op1 > num2 / den2, zero if op1 = num2 / den2, and a negative value if op1 < num2 / den2.
Remarks

num2 and den2 are allowed to have common factors.

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

// Assert that op1 == 3/6.
Assert.IsTrue(gmp_lib.mpq_cmp_ui(op1, 3, 6U) == 0);

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

' Assert that op1 == 3/6.
Assert.IsTrue(gmp_lib.mpq_cmp_ui(op1, 3, 6UI) = 0)

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

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