gmp_libmpq_cmp Method |
Namespace: Math.Gmp.Native
public static int mpq_cmp( mpq_t op1, mpq_t op2 )
Public Shared Function mpq_cmp ( op1 As mpq_t, op2 As mpq_t ) As Integer
public: static int mpq_cmp( mpq_t^ op1, mpq_t^ op2 )
static member mpq_cmp : op1 : mpq_t * op2 : mpq_t -> int
To determine if two rationals are equal, mpq_equal is faster than mpq_cmp.
// 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); // Create, initialize, and set the value of op2 to 1 / 3. mpq_t op2 = new mpq_t(); gmp_lib.mpq_init(op2); gmp_lib.mpq_set_si(op2, 1, 3U); // Assert that op1 > op2. Assert.IsTrue(gmp_lib.mpq_cmp(op1, op2) > 0); // Release unmanaged memory allocated for op1 and op2. gmp_lib.mpq_clears(op1, op2, null);
' 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) ' Create, initialize, and set the value of op2 to 1 / 3. Dim op2 As New mpq_t() gmp_lib.mpq_init(op2) gmp_lib.mpq_set_si(op2, 1, 3UI) ' Assert that op1 > op2. Assert.IsTrue(gmp_lib.mpq_cmp(op1, op2) > 0) ' Release unmanaged memory allocated for op1 and op2. gmp_lib.mpq_clears(op1, op2, Nothing)
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.