gmp_libmpz_sqrtrem Method |
Set
rop1 to the truncated integer part of the square root of
op, like
mpz_sqrt. Set
rop2 to the remainder
op -
rop1 *
rop1, which will be zero if
op is a perfect square.
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_sqrtrem(
mpz_t rop1,
mpz_t rop2,
mpz_t op
)
Public Shared Sub mpz_sqrtrem (
rop1 As mpz_t,
rop2 As mpz_t,
op As mpz_t
)
public:
static void mpz_sqrtrem(
mpz_t^ rop1,
mpz_t^ rop2,
mpz_t^ op
)
static member mpz_sqrtrem :
rop1 : mpz_t *
rop2 : mpz_t *
op : mpz_t -> unit
Parameters
- rop1
- Type: Math.Gmp.Nativempz_t
The result square root integer. - rop2
- Type: Math.Gmp.Nativempz_t
The result remainder integer. - op
- Type: Math.Gmp.Nativempz_t
The operand integer.
Examples
mpz_t op = new mpz_t();
gmp_lib.mpz_init_set_si(op, 10000);
mpz_t root = new mpz_t();
mpz_t rem = new mpz_t();
gmp_lib.mpz_inits(root, rem);
gmp_lib.mpz_sqrtrem(root, rem, op);
Assert.IsTrue(gmp_lib.mpz_get_si(root) == 100);
Assert.IsTrue(gmp_lib.mpz_get_si(rem) == 0);
gmp_lib.mpz_clears(root, rem, op, null);
Dim op As New mpz_t()
gmp_lib.mpz_init_set_si(op, 10000)
Dim root As New mpz_t()
Dim[rem] As New mpz_t()
gmp_lib.mpz_inits(root, [rem])
gmp_lib.mpz_sqrtrem(root, [rem], op)
Assert.IsTrue(gmp_lib.mpz_get_si(root) = 100)
Assert.IsTrue(gmp_lib.mpz_get_si([rem]) = 0)
gmp_lib.mpz_clears(root, [rem], op, Nothing)
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