Click or drag to resize
gmp_libmpz_perfect_square_p Method
Return non-zero if op is a perfect square, i.e., if the square root of op is an integer.

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 int mpz_perfect_square_p(
	mpz_t op
)

Parameters

op
Type: Math.Gmp.Nativempz_t
The operand integer.

Return Value

Type: Int32
Non-zero if op is a perfect square, i.e., if the square root of op is an integer.
Remarks

Under this definition both 0 and 1 are considered to be perfect squares.

Examples
// Create, initialize, and set the value of x to 10000.
mpz_t op = new mpz_t();
gmp_lib.mpz_init_set_si(op, 10000);

// Assert that op is a perfect square.
Assert.IsTrue(gmp_lib.mpz_perfect_square_p(op) > 0);

// Release unmanaged memory allocated for op.
gmp_lib.mpz_clear(op);
See Also