gmp_lib.mpz_get_d Method

GMP Native Interface for .NET

gmp_libmpz_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 mpz_get_d(
	mpz_t op
)
Public Shared Function mpz_get_d ( 
	op As mpz_t
) As Double
public:
static double mpz_get_d(
	mpz_t^ op
)
static member mpz_get_d : 
        op : mpz_t -> float 

Parameters

op
Type: Math.Gmp.Nativempz_t
The integer.

Return Value

Type: Double
op as a double, truncating it if necessary (i.e. rounding towards zero).
Remarks

If the exponent from the conversion is too big, the result is system dependent. An infinity is returned where available. A hardware overflow trap may or may not occur.

Examples
// Create, initialize, and set the value of x to 10.
mpz_t x = new mpz_t();
gmp_lib.mpz_init_set_d(x, 10.7D);

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

// Release unmanaged memory allocated for x.
gmp_lib.mpz_clear(x);
' Create, initialize, and set the value of x to 10.
Dim x As New mpz_t()
gmp_lib.mpz_init_set_d(x, 10.7)

' Assert that the value of x is 10.0.
Assert.IsTrue(gmp_lib.mpz_get_d(x) = 10.0)

' Release unmanaged memory allocated for x.
gmp_lib.mpz_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