GMP Native Interface for .NET
gmp_libmpf_init Method |
Initialize x to 0.
Namespace: Math.Gmp.Native
Assembly: Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)

public static void mpf_init( mpf_t x )
Public Shared Sub mpf_init ( x As mpf_t )
public: static void mpf_init( mpf_t^ x )
static member mpf_init : x : mpf_t -> unit
Parameters
- x
- Type: Math.Gmp.Nativempf_t
The operand float.

Normally, a variable should be initialized once only or at least be cleared, using mpf_clear, between initializations. The precision of x is undefined unless a default precision has already been established by a call to mpf_set_default_prec.

// 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);
' Set default precision to 64 bits. gmp_lib.mpf_set_default_prec(64UI) ' Create and initialize a new floating-point number x. Dim x As 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)
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.
