Click or drag to resize
gmp_libmpq_get_d Method
Convert op to a double, truncating if necessary (i.e. rounding towards zero).

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 double mpq_get_d(
	mpq_t op
)

Parameters

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

Return Value

Type: Double
The converted double.
Remarks

If the exponent from the conversion is too big or too small to fit a double then the result is system dependent. For too big an infinity is returned when available. For too small 0.0 is normally returned. Hardware overflow, underflow and denorm traps may or may not occur.

Examples
// Create, initialize, and set the value of x to 10 / 11.
mpq_t x = new mpq_t();
gmp_lib.mpq_init(x);
gmp_lib.mpq_set_si(x, 10, 11U);

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

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