gmp_libmpq_init Method |
Namespace: Math.Gmp.Native
public static void mpq_init( mpq_t x )
Public Shared Sub mpq_init ( x As mpq_t )
public: static void mpq_init( mpq_t^ x )
static member mpq_init : x : mpq_t -> unit
Each variable should normally only be initialized once, or at least cleared out (using the function mpq_clear) between each initialization.
// Create and initialize a new rational x. mpq_t x = new mpq_t(); gmp_lib.mpq_init(x); // Assert that the value of x is 0. char_ptr s = gmp_lib.mpq_get_str(char_ptr.Zero, 10, x); Assert.IsTrue(s.ToString() == "0"); // Release unmanaged memory allocated for x and its string value. gmp_lib.mpq_clear(x); gmp_lib.free(s);
' Create and initialize a new rational x. Dim x As New mpq_t() gmp_lib.mpq_init(x) ' Assert that the value of x is 0. Dim s As char_ptr = gmp_lib.mpq_get_str(char_ptr.Zero, 10, x) Assert.IsTrue(s.ToString() = "0") ' Release unmanaged memory allocated for x and its string value. gmp_lib.mpq_clear(x) gmp_lib.free(s)
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.