gmp_lib.mpq_set_si Method

GMP Native Interface for .NET

gmp_libmpq_set_si Method
Set the value of rop to 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 mpq_set_si(
	mpq_t rop,
	int op1,
	uint op2
)
Public Shared Sub mpq_set_si ( 
	rop As mpq_t,
	op1 As Integer,
	op2 As UInteger
)
public:
static void mpq_set_si(
	mpq_t^ rop, 
	int op1, 
	unsigned int op2
)
static member mpq_set_si : 
        rop : mpq_t * 
        op1 : int * 
        op2 : uint32 -> unit 

Parameters

rop
Type: Math.Gmp.Nativempq_t
The result rational.
op1
Type: SystemInt32
The first operand rational.
op2
Type: SystemUInt32
The second operand rational.
Remarks

Note that if op1 and op2 have common factors, rop has to be passed to mpq_canonicalize before any operations are performed on rop.

Examples
// Create and initialize a new rational x.
mpq_t x = new mpq_t();
gmp_lib.mpq_init(x);

// Set the value of x to -10 / 11.
gmp_lib.mpq_set_si(x, -10, 11);

// Assert that the value of x is -10 / 1.
Assert.IsTrue(gmp_lib.mpq_cmp_si(x, -10, 11U) == 0);

// Release unmanaged memory allocated for x.
gmp_lib.mpq_clear(x);
' Create and initialize a new rational x.
Dim x As New mpq_t()
gmp_lib.mpq_init(x)

' Set the value of x to -10 / 11.
gmp_lib.mpq_set_si(x, -10, 11)

' Assert that the value of x is -10 / 1.
Assert.IsTrue(gmp_lib.mpq_cmp_si(x, -10, 11UI) = 0)

' Release unmanaged memory allocated for x.
gmp_lib.mpq_clear(x)

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