Click or drag to resize
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
)

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);
See Also