gmp_lib.mpz_divexact_ui Method

GMP Native Interface for .NET

gmp_libmpz_divexact_ui Method
Set q to n / d when it is known in advance that d divides n.

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 mpz_divexact_ui(
	mpz_t q,
	mpz_t n,
	uint d
)
Public Shared Sub mpz_divexact_ui ( 
	q As mpz_t,
	n As mpz_t,
	d As UInteger
)
public:
static void mpz_divexact_ui(
	mpz_t^ q, 
	mpz_t^ n, 
	unsigned int d
)
static member mpz_divexact_ui : 
        q : mpz_t * 
        n : mpz_t * 
        d : uint32 -> unit 

Parameters

q
Type: Math.Gmp.Nativempz_t
The result quotient integer.
n
Type: Math.Gmp.Nativempz_t
The numerator integer.
d
Type: SystemUInt32
The denominator integer.
Examples
// Create, initialize, and set the value of x to 10000.
mpz_t x = new mpz_t();
gmp_lib.mpz_init_set_ui(x, 10000U);

// Create, initialize, and set the value of z to 0.
mpz_t z = new mpz_t();
gmp_lib.mpz_init(z);

// Set z = x / 5.
gmp_lib.mpz_divexact_ui(z, x, 5U);

// Assert that z is 2000.
Assert.IsTrue(gmp_lib.mpz_get_si(z) == 2000);

// Release unmanaged memory allocated for x and z.
gmp_lib.mpz_clears(x, z, null);
' Create, initialize, and set the value of x to 10000.
Dim x As New mpz_t()
gmp_lib.mpz_init_set_ui(x, 10000UI)

' Create, initialize, and set the value of z to 0.
Dim z As New mpz_t()
gmp_lib.mpz_init(z)

' Set z = x / 5.
gmp_lib.mpz_divexact_ui(z, x, 5UI)

' Assert that z is 2000.
Assert.IsTrue(gmp_lib.mpz_get_si(z) = 2000)

' Release unmanaged memory allocated for x and z.
gmp_lib.mpz_clears(x, z, 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