gmp_lib.mpq_inits Method

GMP Native Interface for .NET

gmp_libmpq_inits Method
Initialize a NULL-terminated list of mpq_t variables, and set their values to 0/1.

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 mpq_inits(
	params mpq_t[] x
)
Public Shared Sub mpq_inits ( 
	ParamArray x As mpq_t()
)
public:
static void mpq_inits(
	... array<mpq_t^>^ x
)
static member mpq_inits : 
        x : mpq_t[] -> unit 

Parameters

x
Type: Math.Gmp.Nativempq_t
The operand rational.
Examples
// Create new rationals x1, x2 and x3.
mpq_t x1 = new mpq_t();
mpq_t x2 = new mpq_t();
mpq_t x3 = new mpq_t();

// Initialize the rationals.
gmp_lib.mpq_inits(x1, x2, x3);

// Assert that their value is 0.
Assert.IsTrue(gmp_lib.mpq_get_d(x1) == 0.0);
Assert.IsTrue(gmp_lib.mpq_get_d(x2) == 0.0);
Assert.IsTrue(gmp_lib.mpq_get_d(x3) == 0.0);

// Release unmanaged memory allocated for the rationals.
gmp_lib.mpq_clears(x1, x2, x3, null);
' Create new rationals x1, x2 and x3.
Dim x1 As New mpq_t()
Dim x2 As New mpq_t()
Dim x3 As New mpq_t()

' Initialize the rationals.
gmp_lib.mpq_inits(x1, x2, x3)

' Assert that their value is 0.
Assert.IsTrue(gmp_lib.mpq_get_d(x1) = 0.0)
Assert.IsTrue(gmp_lib.mpq_get_d(x2) = 0.0)
Assert.IsTrue(gmp_lib.mpq_get_d(x3) = 0.0)

' Release unmanaged memory allocated for the rationals.
gmp_lib.mpq_clears(x1, x2, x3, Nothing)

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.

See Also