gmp_lib.mpz_gcd_ui Method

GMP Native Interface for .NET

gmp_libmpz_gcd_ui Method
Compute the greatest common divisor of op1 and op2. If rop is not null, store the result there.

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 uint mpz_gcd_ui(
	mpz_t rop,
	mpz_t op1,
	uint op2
)
Public Shared Function mpz_gcd_ui ( 
	rop As mpz_t,
	op1 As mpz_t,
	op2 As UInteger
) As UInteger
public:
static unsigned int mpz_gcd_ui(
	mpz_t^ rop, 
	mpz_t^ op1, 
	unsigned int op2
)
static member mpz_gcd_ui : 
        rop : mpz_t * 
        op1 : mpz_t * 
        op2 : uint32 -> uint32 

Parameters

rop
Type: Math.Gmp.Nativempz_t
The result operand integer.
op1
Type: Math.Gmp.Nativempz_t
The first operand integer.
op2
Type: SystemUInt32
The second operand integer.

Return Value

Type: UInt32
If the result is small enough to fit in an unsigned int, it is returned. If the result does not fit, 0 is returned, and the result is equal to the argument op1.
Remarks

Note that the result will always fit if op2 is non-zero.

Examples
// Create, initialize, and set the value of op1 to 63.
mpz_t op1 = new mpz_t();
gmp_lib.mpz_init_set_ui(op1, 63U);

// Return the greatest common divisor of op1 and 70.
Assert.IsTrue(gmp_lib.mpz_gcd_ui(null, op1, 70U) == 7);

// Release unmanaged memory allocated for op1.
gmp_lib.mpz_clear(op1);
' Create, initialize, and set the value of op1 to 63.
Dim op1 As New mpz_t()
gmp_lib.mpz_init_set_ui(op1, 63UI)

' Return the greatest common divisor of op1 and 70.
Assert.IsTrue(gmp_lib.mpz_gcd_ui(Nothing, op1, 70UI) = 7)
' Release unmanaged memory allocated for op1.
gmp_lib.mpz_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