GMP Native Interface for .NET
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)

public static double mpq_get_d( mpq_t op )
Public Shared Function mpq_get_d ( op As mpq_t ) As Double
public: static double mpq_get_d( mpq_t^ op )
static member mpq_get_d : op : mpq_t -> float
Parameters
- op
- Type: Math.Gmp.Nativempq_t
The operand rational.
Return Value
Type: DoubleThe converted double.

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.

// 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);
' Create, initialize, and set the value of x to 10 / 11. Dim x As New mpq_t() gmp_lib.mpq_init(x) gmp_lib.mpq_set_si(x, 10, 11UI) ' 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)
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.
