gmp_lib.mpz_neg Method

GMP Native Interface for .NET

gmp_libmpz_neg Method
Set rop to -op.

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_neg(
	mpz_t rop,
	mpz_t op
)
Public Shared Sub mpz_neg ( 
	rop As mpz_t,
	op As mpz_t
)
public:
static void mpz_neg(
	mpz_t^ rop, 
	mpz_t^ op
)
static member mpz_neg : 
        rop : mpz_t * 
        op : mpz_t -> unit 

Parameters

rop
Type: Math.Gmp.Nativempz_t
The result integer.
op
Type: Math.Gmp.Nativempz_t
The operand integer.
Examples
// Create, initialize, and set the value of x to -10000.
mpz_t x = new mpz_t();
gmp_lib.mpz_init_set_si(x, -10000);

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

// Set z = -x.
gmp_lib.mpz_neg(z, x);

// Assert that z is -x.
Assert.IsTrue(gmp_lib.mpz_get_si(z) == 10000);

// 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_si(x, -10000)

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

' Set z = -x.
gmp_lib.mpz_neg(z, x)

' Assert that z is -x.
Assert.IsTrue(gmp_lib.mpz_get_si(z) = 10000)

' 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