Click or drag to resize
gmp_libmpf_init2 Method
Initialize x to 0 and set its precision to be at least prec bits.

Namespace:  Math.Gmp.Native
Assembly:  Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static void mpf_init2(
	mpf_t x,
	mp_bitcnt_t prec
)

Parameters

x
Type: Math.Gmp.Nativempf_t
The operand float.
prec
Type: Math.Gmp.Nativemp_bitcnt_t
The minimum precision in bits.
Remarks

Normally, a variable should be initialized once only or at least be cleared, using mpf_clear, between initializations.

Examples
// Create and initialize a new floating-point number x with 64-bit precision.
mpf_t x = new mpf_t();
gmp_lib.mpf_init2(x, 64U);

// Assert that the value of x is 0.0, and that its precision is 64 bits.
Assert.IsTrue(gmp_lib.mpf_get_d(x) == 0.0);
uint p = gmp_lib.mpf_get_prec(x);
Assert.IsTrue(gmp_lib.mpf_get_prec(x) == 64U);

// Release unmanaged memory allocated for x.
gmp_lib.mpf_clear(x);
See Also