gmp_libmpq_set_f Method |
Namespace: Math.Gmp.Native
public static void mpq_set_f( mpq_t rop, mpf_t op )
Public Shared Sub mpq_set_f ( rop As mpq_t, op As mpf_t )
public: static void mpq_set_f( mpq_t^ rop, mpf_t^ op )
static member mpq_set_f : rop : mpq_t * op : mpf_t -> unit
// Create, initialize, and set a new rational x to 10 / 11. mpq_t x = new mpq_t(); gmp_lib.mpq_init(x); gmp_lib.mpq_set_si(x, 10, 11); // Create, initialize, and set a new float y to -210. mpf_t y = new mpf_t(); gmp_lib.mpf_init(y); gmp_lib.mpf_set_si(y, -210); // Assign the value of y to x. gmp_lib.mpq_set_f(x, y); // Assert that the value of x is -210 / 1. Assert.IsTrue(gmp_lib.mpq_cmp_si(x, -210, 1) == 0); // Release unmanaged memory allocated for x and y. gmp_lib.mpq_clear(x); gmp_lib.mpf_clear(y);
' Create, initialize, and set a new rational x to 10 / 11. Dim x As New mpq_t() gmp_lib.mpq_init(x) gmp_lib.mpq_set_si(x, 10, 11) ' Create, initialize, and set a new float y to -210. Dim y As New mpf_t() gmp_lib.mpf_init(y) gmp_lib.mpf_set_si(y, -210) ' Assign the value of y to x. gmp_lib.mpq_set_f(x, y) ' Assert that the value of x is -210 / 1. Assert.IsTrue(gmp_lib.mpq_cmp_si(x, -210, 1) = 0) ' Release unmanaged memory allocated for x and y. gmp_lib.mpq_clear(x) gmp_lib.mpf_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.