gmp_libmpf_set_q Method |
Namespace: Math.Gmp.Native
public static void mpf_set_q( mpf_t rop, mpq_t op )
Public Shared Sub mpf_set_q ( rop As mpf_t, op As mpq_t )
public: static void mpf_set_q( mpf_t^ rop, mpq_t^ op )
static member mpf_set_q : rop : mpf_t * op : mpq_t -> unit
// Create, initialize, and set a new rational y to 200 / 5. mpq_t y = new mpq_t(); gmp_lib.mpq_init(y); gmp_lib.mpq_set_ui(y, 200, 5U); // Create, initialize, and set a new floating-point number x to y. mpf_t x = new mpf_t(); gmp_lib.mpf_init(x); gmp_lib.mpf_set_q(x, y); // Assert that x is 40. Assert.IsTrue(x.ToString() == "0.4e2"); // Release unmanaged memory allocated for x and y. gmp_lib.mpf_clear(x); gmp_lib.mpq_clear(y);
' Create, initialize, and set a new rational y to 200 / 5. Dim y As New mpq_t() gmp_lib.mpq_init(y) gmp_lib.mpq_set_ui(y, 200, 5UI) ' Create, initialize, and set a new floating-point number x to y. Dim x As New mpf_t() gmp_lib.mpf_init(x) gmp_lib.mpf_set_q(x, y) ' Assert that x is 40. Assert.IsTrue(x.ToString() = "0.4e2") ' Release unmanaged memory allocated for x and y. gmp_lib.mpf_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.