gmp_libmpz_set_q Method |
Namespace: Math.Gmp.Native
public static void mpz_set_q( mpz_t rop, mpq_t op )
Public Shared Sub mpz_set_q ( rop As mpz_t, op As mpq_t )
public: static void mpz_set_q( mpz_t^ rop, mpq_t^ op )
static member mpz_set_q : rop : mpz_t * op : mpq_t -> unit
mpz_set_q truncate op to make it an integer.
// Create and initialize new integer x, and rational y. mpz_t x = new mpz_t(); gmp_lib.mpz_init(x); mpq_t y = "100/3"; // Set the value of x to the truncation of 100/3. gmp_lib.mpz_set_q(x, y); // Assert that the value of x is 33. Assert.IsTrue(gmp_lib.mpz_get_si(x) == 33); // Release unmanaged memory allocated for x and y. gmp_lib.mpz_clear(x); gmp_lib.mpq_clear(y);
' Create and initialize new integer x, and rational y. Dim x As New mpz_t() gmp_lib.mpz_init(x) Dim y As mpq_t = "100/3" ' Set the value of x to the truncation of 100/3. gmp_lib.mpz_set_q(x, y) ' Assert that the value of x is 33. Assert.IsTrue(gmp_lib.mpz_get_si(x) = 33) ' Release unmanaged memory allocated for x and y. gmp_lib.mpz_clear(x) gmp_lib.mpq_clear(y)
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.