gmp_libmpf_init Method |
Namespace: Math.Gmp.Native
Normally, a variable should be initialized once only or at least be cleared, using mpf_clear(mpf_t), between initializations. The precision of x is undefined unless a default precision has already been established by a call to mpf_set_default_prec(mp_bitcnt_t).
// Set default precision to 64 bits. gmp_lib.mpf_set_default_prec(64U); // Create and initialize a new floating-point number x. mpf_t x = new mpf_t(); gmp_lib.mpf_init(x); // Assert that the value of x is 0.0. Assert.IsTrue(gmp_lib.mpf_get_d(x) == 0.0); // Release unmanaged memory allocated for x. gmp_lib.mpf_clear(x);