Click or drag to resize
gmp_libmpf_set_q Method
Set the value of rop from op.

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 mpf_set_q(
	mpf_t rop,
	mpq_t op
)

Parameters

rop
Type: Math.Gmp.Nativempf_t
The result float.
op
Type: Math.Gmp.Nativempq_t
The operand.
Examples
// Create, initialize, and set a new rational y to 200 / 5.
mpq_t y = new mpq_t();
gmp_lib.mpq_init(y);
gmp_lib.mpq_set_ui(y, 200, 5U);

// Create, initialize, and set a new floating-point number x to y.
mpf_t x = new mpf_t();
gmp_lib.mpf_init(x);
gmp_lib.mpf_set_q(x, y);

// Assert that x is 40.
Assert.IsTrue(x.ToString() == "0.4e2");

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