Click or drag to resize
gmp_libmpq_set_d Method
Set rop to the value of op. There is no rounding, this conversion is exact.

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_d(
	mpq_t rop,
	double op
)

Parameters

rop
Type: Math.Gmp.Nativempq_t
The result rational.
op
Type: SystemDouble
The operand double.
Examples
// Create and initialize a new rational.
mpq_t x = new mpq_t();
gmp_lib.mpq_init(x);

// Set the value of x to 10.0 / 11.0.
gmp_lib.mpq_set_d(x, 10.0D / 11.0);

// Assert that the value of x is 10.0 / 11.0.
Assert.IsTrue(gmp_lib.mpq_get_d(x) == 10.0D / 11.0);

// Release unmanaged memory allocated for x.
gmp_lib.mpq_clear(x);
See Also