gmp_lib.mpq_sgn Method

GMP Native Interface for .NET

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

Parameters

op
Type: Math.Gmp.Nativempq_t
The operand rational.

Return Value

Type: Int32
Return +1 if op > 0, 0 if op = 0, and -1 if op < 0.
Examples
// Create, initialize, and set a new rational x to -10 / 11.
mpq_t op = new mpq_t();
gmp_lib.mpq_init(op);
gmp_lib.mpq_set_si(op, -10, 11);

// Assert that op is negative.
Assert.IsTrue(gmp_lib.mpq_sgn(op) == -1);

// Release unmanaged memory allocated for x and y.
gmp_lib.mpq_clear(op);
' Create, initialize, and set a new rational x to -10 / 11.
Dim op As New mpq_t()
gmp_lib.mpq_init(op)
gmp_lib.mpq_set_si(op, -10, 11)

' Assert that op is negative.
Assert.IsTrue(gmp_lib.mpq_sgn(op) = -1)

' Release unmanaged memory allocated for x and y.
gmp_lib.mpq_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