gmp_libmpz_cdiv_r_2exp Method |
Namespace: Math.Gmp.Native
public static void mpz_cdiv_r_2exp( mpz_t r, mpz_t n, mp_bitcnt_t b )
Public Shared Sub mpz_cdiv_r_2exp ( r As mpz_t, n As mpz_t, b As mp_bitcnt_t )
public: static void mpz_cdiv_r_2exp( mpz_t^ r, mpz_t^ n, mp_bitcnt_t b )
static member mpz_cdiv_r_2exp : r : mpz_t * n : mpz_t * b : mp_bitcnt_t -> unit
// Create, initialize, and set the value of n to 10001. mpz_t n = new mpz_t(); gmp_lib.mpz_init_set_si(n, 10001); // Create, initialize, and set the value of r to 0. mpz_t r = new mpz_t(); gmp_lib.mpz_init(r); // Set r = n - 2^2 * ceiling(n / 2^2) gmp_lib.mpz_cdiv_r_2exp(r, n, 2U); // Assert that r is -3. Assert.IsTrue(gmp_lib.mpz_get_si(r) == -3); // Release unmanaged memory allocated for n and r. gmp_lib.mpz_clears(n, r, null);
' Create, initialize, and set the value of n to 10001. Dim n As New mpz_t() gmp_lib.mpz_init_set_si(n, 10001) ' Create, initialize, and set the value of r to 0. Dim r As New mpz_t() gmp_lib.mpz_init(r) ' Set r = n - 2^2 * ceiling(n / 2^2) gmp_lib.mpz_cdiv_r_2exp(r, n, 2UI) ' Assert that r is -3. Assert.IsTrue(gmp_lib.mpz_get_si(r) = -3) ' Release unmanaged memory allocated for n and r. gmp_lib.mpz_clears(n, r, 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.