gmp_lib.mpz_addmul Method

GMP Native Interface for .NET

gmp_libmpz_addmul Method
Set rop to rop + op1 * op2.

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_addmul(
	mpz_t rop,
	mpz_t op1,
	mpz_t op2
)
Public Shared Sub mpz_addmul ( 
	rop As mpz_t,
	op1 As mpz_t,
	op2 As mpz_t
)
public:
static void mpz_addmul(
	mpz_t^ rop, 
	mpz_t^ op1, 
	mpz_t^ op2
)
static member mpz_addmul : 
        rop : mpz_t * 
        op1 : mpz_t * 
        op2 : mpz_t -> unit 

Parameters

rop
Type: Math.Gmp.Nativempz_t
The result integer.
op1
Type: Math.Gmp.Nativempz_t
The first operand integer.
op2
Type: Math.Gmp.Nativempz_t
The second operand 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 y to 12222.
mpz_t y = new mpz_t();
gmp_lib.mpz_init_set_ui(y, 12222U);

// Create, initialize, and set the value of z to 20000.
mpz_t z = new mpz_t();
gmp_lib.mpz_init_set_ui(z, 20000U);

// Set z += x * y.
gmp_lib.mpz_addmul(z, x, y);

// Assert that z has been incremented by 10000 * 12222.
Assert.IsTrue(gmp_lib.mpz_get_si(z) == 20000U + 10000 * 12222);

// Release unmanaged memory allocated for x and z.
gmp_lib.mpz_clears(x, y, 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 y to 12222.
Dim y As New mpz_t()
gmp_lib.mpz_init_set_ui(y, 12222UI)

' Create, initialize, and set the value of z to 20000.
Dim z As New mpz_t()
gmp_lib.mpz_init_set_ui(z, 20000UI)

' Set z += x * y.
gmp_lib.mpz_addmul(z, x, y)

' Assert that z has been incremented by 10000 * 12222.
Assert.IsTrue(gmp_lib.mpz_get_si(z) = 20000UI + 10000 * 12222)

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