gmp_lib.mpz_congruent_2exp_p Method

GMP Native Interface for .NET

gmp_libmpz_congruent_2exp_p Method
Return non-zero if n is congruent to c modulo 2^b.

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 mpz_congruent_2exp_p(
	mpz_t n,
	mpz_t c,
	mp_bitcnt_t b
)
Public Shared Function mpz_congruent_2exp_p ( 
	n As mpz_t,
	c As mpz_t,
	b As mp_bitcnt_t
) As Integer
public:
static int mpz_congruent_2exp_p(
	mpz_t^ n, 
	mpz_t^ c, 
	mp_bitcnt_t b
)
static member mpz_congruent_2exp_p : 
        n : mpz_t * 
        c : mpz_t * 
        b : mp_bitcnt_t -> int 

Parameters

n
Type: Math.Gmp.Nativempz_t
An operand integer.
c
Type: Math.Gmp.Nativempz_t
The remainder of the division by 2^b.
b
Type: Math.Gmp.Nativemp_bitcnt_t
The exponent of the power of two divisor.

Return Value

Type: Int32
Non-zero if n is congruent to c modulo 2^b.
Remarks

n is congruent to c mod 2^b if there exists an integer q satisfying n = c + q * 2^b.

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

// Create, initialize, and set the value of b to 1.
mpz_t c = new mpz_t();
gmp_lib.mpz_init_set_ui(c, 1U);

// Assert that n is congruent to c mod 2^3.
Assert.IsTrue(gmp_lib.mpz_congruent_2exp_p(n, c, 3U) > 0);

// Release unmanaged memory allocated for n and c.
gmp_lib.mpz_clears(n, c, null);
' Create, initialize, and set the value of n to 10001.
Dim n As New mpz_t()
gmp_lib.mpz_init_set_ui(n, 10001UI)

' Create, initialize, and set the value of b to 1.
Dim c As New mpz_t()
gmp_lib.mpz_init_set_ui(c, 1UI)

' Assert that n is congruent to c mod 2^3.
Assert.IsTrue(gmp_lib.mpz_congruent_2exp_p(n, c, 3UI) > 0)

' Release unmanaged memory allocated for n and c.
gmp_lib.mpz_clears(n, c, 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.

See Also