Click or drag to resize
gmp_libmpz_sqrt Method
Set rop to the truncated integer part of the square root of 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 mpz_sqrt(
	mpz_t rop,
	mpz_t op
)

Parameters

rop
Type: Math.Gmp.Nativempz_t
The result square root integer.
op
Type: Math.Gmp.Nativempz_t
The operand integer.
Examples
// Create, initialize, and set the value of op to 10000.
mpz_t op = new mpz_t();
gmp_lib.mpz_init_set_si(op, 10000);

// Create, initialize, and set the value of rop to 0.
mpz_t rop = new mpz_t();
gmp_lib.mpz_init(rop);

// Set rop = trunc(sqrt(op)).
gmp_lib.mpz_sqrt(rop, op);

// Assert that rop is 100.
Assert.IsTrue(gmp_lib.mpz_get_si(rop) == 100);

// Release unmanaged memory allocated for rop and op.
gmp_lib.mpz_clears(rop, op, null);
See Also