gmp_lib.mpz_sgn Method

GMP Native Interface for .NET

gmp_libmpz_sgn Method
Return +1 if op > 0, 0 if op = 0, and -1 if op < 0.

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 int mpz_sgn(
	mpz_t op
)
Public Shared Function mpz_sgn ( 
	op As mpz_t
) As Integer
public:
static int mpz_sgn(
	mpz_t^ op
)
static member mpz_sgn : 
        op : mpz_t -> int 

Parameters

op
Type: Math.Gmp.Nativempz_t
The operand integer.

Return Value

Type: Int32
Return +1 if op > 0, 0 if op = 0, and -1 if op < 0.
Examples
// Create, initialize, and set the value of op to -10.
mpz_t op = new mpz_t();
gmp_lib.mpz_init_set_si(op, -10);

// Assert that the sign of op is -1.
Assert.IsTrue(gmp_lib.mpz_sgn(op) == -1);

// Release unmanaged memory allocated for op.
gmp_lib.mpz_clear(op);
' Create, initialize, and set the value of op to -10.
Dim op As New mpz_t()
gmp_lib.mpz_init_set_si(op, -10)

' Assert that the sign of op is -1.
Assert.IsTrue(gmp_lib.mpz_sgn(op) = -1)

' Release unmanaged memory allocated for op.
gmp_lib.mpz_clear(op)

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