GMP Native Interface for .NET
gmp_libmpz_rootrem Method |
Set root to the truncated integer part of the nth root of u. Set rem to the remainder, u - root^n.
Namespace: Math.Gmp.Native
Assembly: Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)

public static void mpz_rootrem( mpz_t root, mpz_t rem, mpz_t u, uint n )
Public Shared Sub mpz_rootrem ( root As mpz_t, rem As mpz_t, u As mpz_t, n As UInteger )
public: static void mpz_rootrem( mpz_t^ root, mpz_t^ rem, mpz_t^ u, unsigned int n )
static member mpz_rootrem : root : mpz_t * rem : mpz_t * u : mpz_t * n : uint32 -> unit
Parameters
- root
- Type: Math.Gmp.Nativempz_t
The result root integer. - rem
- Type: Math.Gmp.Nativempz_t
The result remainder integer. - u
- Type: Math.Gmp.Nativempz_t
The first operand integer. - n
- Type: SystemUInt32
The second operand integer.

// Create, initialize, and set the value of u to 10000. mpz_t u = new mpz_t(); gmp_lib.mpz_init_set_si(u, 10000); // Create, initialize, and set the values of root and rem to 0. mpz_t root = new mpz_t(); mpz_t rem = new mpz_t(); gmp_lib.mpz_inits(root, rem, null); // Set root = trunc(cbrt(10000)) and rem = u - root. gmp_lib.mpz_rootrem(root, rem, u, 3U); // Assert that root is 21, and rem is 739. Assert.IsTrue(gmp_lib.mpz_get_si(root) == 21); Assert.IsTrue(gmp_lib.mpz_get_si(rem) == 739); // Release unmanaged memory allocated for root, rem, and u. gmp_lib.mpz_clears(root, rem, u, null);
' Create, initialize, and set the value of u to 10000. Dim u As New mpz_t() gmp_lib.mpz_init_set_si(u, 10000) ' Create, initialize, and set the values of root and rem to 0. Dim root As New mpz_t() Dim[rem] As New mpz_t() gmp_lib.mpz_inits(root, [rem], Nothing) ' Set root = trunc(cbrt(10000)) and rem = u - root. gmp_lib.mpz_rootrem(root, [rem], u, 3UI) ' Assert that root is 21, and rem is 739. Assert.IsTrue(gmp_lib.mpz_get_si(root) = 21) Assert.IsTrue(gmp_lib.mpz_get_si([rem]) = 739) ' Release unmanaged memory allocated for root, rem, and u. gmp_lib.mpz_clears(root, [rem], u, 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.
