Set r to n mod d.
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 uint mpz_mod_ui(
mpz_t r,
mpz_t n,
uint d
)
Public Shared Function mpz_mod_ui (
r As mpz_t,
n As mpz_t,
d As UInteger
) As UInteger
public:
static unsigned int mpz_mod_ui(
mpz_t^ r,
mpz_t^ n,
unsigned int d
)
static member mpz_mod_ui :
r : mpz_t *
n : mpz_t *
d : uint32 -> uint32
Parameters
- r
- Type: Math.Gmp.Nativempz_t
The result remainder integer. - n
- Type: Math.Gmp.Nativempz_t
The numerator integer. - d
- Type: SystemUInt32
The denominator integer.
Return Value
Type:
UInt32The remainder
r.
Remarks
The sign of the divisor is ignored; the result is always non-negative.
mpz_mod_ui is identical to mpz_fdiv_r_ui, returning the remainder as well as setting r.
See mpz_fdiv_ui if only the return value is wanted.
Examples
mpz_t x = new mpz_t();
gmp_lib.mpz_init_set_ui(x, 12222U);
mpz_t z = new mpz_t();
gmp_lib.mpz_init(z);
Assert.IsTrue(gmp_lib.mpz_mod_ui(z, x, 10000U) == 12222 % 10000);
Assert.IsTrue(gmp_lib.mpz_get_si(z) == 12222 % 10000);
gmp_lib.mpz_clears(x, z, null);
Dim x As New mpz_t()
gmp_lib.mpz_init_set_ui(x, 12222UI)
Dim z As New mpz_t()
gmp_lib.mpz_init(z)
Assert.IsTrue(gmp_lib.mpz_mod_ui(z, x, 10000UI) = 12222 Mod 10000)
Assert.IsTrue(gmp_lib.mpz_get_si(z) = 12222 Mod 10000)
gmp_lib.mpz_clears(x, z, 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